Quantcast
Channel: ASP.NET AJAX + Ajax Control Toolkit (ACT)
Viewing all 5678 articles
Browse latest View live

asp:AsyncPostBackTrigger Button

$
0
0
<asp:UpdatePanel runat="server"><ContentTemplate><asp:Timer ID="Timer1" runat="server" Interval="5000"></asp:Timer><asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" AllowPaging="True" AllowSorting="True" OnSorting="GridView1_Sorting" PageSize="10"><PagerSettings Position="Top" /><Columns><asp:CommandField ShowSelectButton="True"></asp:CommandField><%-- <asp:BoundField DataField="IssueId" HeaderText="Issue Id" SortExpression="IssueId" HtmlEncode="False"></asp:BoundField><asp:BoundField DataField="IssueName" HeaderText="Issue Type" SortExpression="IssueName" HtmlEncode="False"></asp:BoundField><asp:BoundField DataField="Status_Description" HeaderText="Issue Status" SortExpression="Status_Description" HtmlEncode="False"></asp:BoundField>--%><asp:BoundField DataField="Username" HeaderText="" SortExpression="Username" HtmlEncode="False"></asp:BoundField><%--<asp:BoundField DataField="Assign_Remarks" HeaderText="Remarks" SortExpression="Assign_Remarks" HtmlEncode="false"></asp:BoundField>--%><asp:TemplateField HeaderText="" SortExpression="message"><ItemTemplate><asp:Literal ID="lt_remarks" runat="server" Text='<%# DataBinder.Eval(Container, "DataItem.message").ToString().Replace(Environment.NewLine, "<br />").Replace("\r\n","<br />").Replace("\n","<br />")%>'></asp:Literal></ItemTemplate></asp:TemplateField><asp:TemplateField HeaderText="" SortExpression="PostedDatetime"><ItemTemplate><asp:Literal ID="lt_postedDateTime" runat="server" Text='<%# DataBinder.Eval(Container, "DataItem.PostedDatetime")%>'></asp:Literal></ItemTemplate></asp:TemplateField><%-- <asp:BoundField DataField="ISACTIVE" HeaderText="ISACTIVE" SortExpression="ISACTIVE" HtmlEncode="False"></asp:BoundField>--%></Columns><PagerSettings Position="Top" Mode="NumericFirstLast" NextPageText="Next" PreviousPageText="Prev" LastPageText="Last" FirstPageText="First" /><FooterStyle BackColor="#FFFFCC" ForeColor="#330099" /><RowStyle BorderStyle="Solid" BorderWidth="1" BorderColor="black" /><HeaderStyle CssClass="GvHeader" />        </asp:GridView><asp:Label ID="Label1" runat="server" Text=""></asp:Label> </ContentTemplate><Triggers><asp:AsyncPostBackTrigger ControlID="btn_send" EventName="Click" /><asp:AsyncPostBackTrigger ControlID="Timer1" EventName="Tick" /></Triggers></asp:UpdatePanel><asp:Label ID="lblmessage" runat="server" Text=""></asp:Label><br /><span><asp:TextBox ID="txt_message" runat="server" TextMode="MultiLine"></asp:TextBox><asp:Button ID="btn_send" runat="server" Text="Send" /></span><asp:TextBox ID="txt_projectID" runat="server" Visible="False" Width="50px"></asp:TextBox><asp:TextBox ID="txt_Username" runat="server" Visible="False" Width="50px"></asp:TextBox><asp:TextBox ID="txt_role" runat="server" Visible="False" Width="50px"></asp:TextBox>


<%-- --%> <%----%> <%-- --%>

Let say i insert below data at textbox:
1

2

3

If i insert asp:AsyncPostBackTrigger Button in the trigger area,
the data i submited will not display break line.
data show: 123


If i remove asp:AsyncPostBackTrigger Button from trigger area,
the data i submitted will display break line.
data show: 
1

2

3

Can anyone advise me, how do i insert asp:AsyncPostBackTrigger at trigger area and the submitted data with show in break line.......


window.open not working with ScriptManager.RegisterStartupScript

$
0
0

I injected a javascript block as follows..

StringBuilder sb1 = new StringBuilder();
sb1.Append("window.open('DMS/DMSHome.aspx','DMS:::','');");
ScriptManager.RegisterStartupScript(Page, typeof(Page), "mydialog", sb1.ToString(), true);

In this page there is no AJAX scriptmanager but I used ScriptManager.RegisterStartupScript which was working fine till yesterday. From today morning it stopped working in IE as well as in Google chrome. Where as alert messages using ScriptManager.RegisterStartupScript is working fine. Problem is only where I was opening a new window.

Then I changed the code and used 

Page.ClientScript.RegisterStartupScript(this.GetType(), "OpenWindow", "window.open('DMS/DMSHome.aspx','_newtab','left=100,top=20,width=1000,height=590');", true);

which is working fine.

Can anybody tell me what really happened so that window.open stopped working in ScriptManager.RegisterStartupScript

Server Error in '/' application

$
0
0

Dear All,

I am running an asp.net application, on signing in, before entering into the home page it throws the error as Server Error in '/' application : Invalid parent ID. and when i again click the URL and press enters it takes me to the home page. i dont know where it goes wrong. but recently i have included a calendar pick using ajax control tool kit. please help me out to get rid of this problem.

Thank you!

with regards,

Jeevanathan.U

Ajax InsertionMode

$
0
0

I created a project to use ajax for the first time and it all seems to be working other than the insertion mode

mvc 5 VB Home - index view first up.

@Using (Ajax.BeginForm("UserEmail", "Home", _
New AjaxOptions _
With {.InsertionMode = InsertionMode.InsertAfter,
.HttpMethod = "GET",
.LoadingElementId = "LoadingDisplay",
.UpdateTargetId = "Users"}))
@<text>

<div class="container body-content">

<br />
<input type="text" name="email" class="form-control col-lg-6" placeholder="Account holders email address" />
<input type="submit" value="search" class="btn btn-primary" style="margin-left:5px; margin-bottom:5px;" />
<img id="ajax-loader" src="~/Content/images/ajax-loader.gif" style="display:none" />
</div>

</text>
End Using

<div id="Users">
</div>

<div id="Display">
@Ajax.ActionLink("Click Me", "UserEmail", _
New AjaxOptions With {
.UpdateTargetId = "Display",
.InsertionMode = InsertionMode.Replace,
.HttpMethod = "GET"})
</div>

The Problem:

When I use either of the ajax calls the input and button disappear and get replaced with the partial result and it isn't formatted very well with a table going off page needing to be scrolled. I'm under the impression that the 2 controls should stay in viewed and the ajax begin form should update the div and the ajax action update itself?


Function UserEmail(email As String) As ActionResult
Dim result = db.AspNetUsers.Include("AspNetUserRoles").ToList
Return PartialView("_UsersInRoles", result)
End Function

Call 1° Server Function, 2° JavaScript Function inside UpdatePanel

$
0
0

Hi guys,

I have an asp button that calls a function that creates a dataset from a query and fills a GridView, then it saves that DataSet into a session. All ok here, but when I try to trigger the JavaScript function it just does nothing. Here is my code, Im trying the ScripManager.RegisterStartupScript and nothing happens.

ASPX - JavaScript

<script type="text/javascript" language="javascript">
   function evtCreateChartLoyalty(){$get("upProgess").style.display = 'block';
      PageMethods.returnChartLoyalty($get("<%=ddlSearchTypeLoyalty.ClientID %>").value, "Current", "Previous", "Loyalty (Time, Country & Regions)" , $get("<%=ddlSearchTypeLoyalty.ClientID %>").value, "Loyal Users", OnSucceededLoyalty, OnFailedLoyalty);
   }
   function OnSucceededLoyalty(result) {
      var aChart = new FusionCharts("../swf/MSLine.swf","idChartLoyalty","1300","800","0","0");
      aChart.setDataXML(result);
      aChart.render("divVsMonthlyCountry");$get("upProgess").style.display = 'none';$get("btnExportarVersusMesesPaisHTML").style.display = '';
   }
   function OnFailedLoyalty(error) {            
      alert("Stack Trace: " + error.get_stackTrace() + "\r\n" + "Error: " + error.get_message() + "\r\n" + "Status Code: " + error.get_statusCode() + "\r\n" + "Exception Type: " + error.get_exceptionType() + "\r\n" + "Timed Out: " + error.get_timedOut()); $get("upProgess").style.display = 'none';
   }</script>

ASPX - .NET

<asp:UpdatePanel ID="upGenerarLoyalty" runat="server"><ContentTemplate><asp:Button ID="btnGenerarLoyaltyTRS" runat="server" Text="Generar" OnClick="btnGenerarLoyaltyTRS_Click" /></ContentTemplate></asp:UpdatePanel>

CS

protected void btnGenerarLoyaltyTRS_Click(object sender, EventArgs e)
{
    //a lot of code and dsActual have data
grdLoyaltyTRS.DataSource = Session["xpressLoyaltyReport"] = dsActual; grdLoyaltyTRS.DataBind(); ScriptManager.RegisterStartupScript(upGenerarLoyalty, this.GetType(), "MyChart", "evtCreateChartLoyalty", true); }


Routing to Webservice

$
0
0

hello to all

i want use ajax to web service and use routing i want use this url in ajax and redirect to webmwthod in webservice

for example services/api/helloword

and i rout to services/global.asmx/helloword

how i cant do it?

i use this code but not work

public static void RegisterRoutes(RouteCollection routes)
{

    routes.MapPageRoute("","services/{action}", "~/Services/global.asmx");
}


   public class WebServiceRouteHandler : IRouteHandler
        {
            private string _VirtualPath;

            public WebServiceRouteHandler(string virtualPath)
            {
                _VirtualPath = virtualPath;
            }

            public IHttpHandler GetHttpHandler(RequestContext requestContext)
            {
                return new WebServiceHandlerFactory().GetHandler(HttpContext.Current,
                    "*",
                    _VirtualPath,
                    HttpContext.Current.Server.MapPath(_VirtualPath));
            }
        }

please help me

Toolkit Controls Show in Toolbox But Will Not Drag and Drop

$
0
0

Windows 7.  Visual Studio 2012.  Ajax Toolkit.

I have the Ajax Toolkit in my toolbox.  All the controls show as active.  However, when I try to drag and drop a control onto my page, nothing shows up where I drop it.  What might be wrong?

Button inside update panel not firing on first click

$
0
0

I'm having an issue with a button inside an update panel (inside a Modal Popup) that populates a listbox in another update panel. Whenever you click the button to populate the listbox, nothing happens the first time. Each subsequent click will populate the listbox with the last input.

The Button in question is either "btnAddExistingContact"(resides in "upnlCallReport" update panel) or "btnAddExistingContactSubmit" (resides in "upnlAddExistingContact")

Here's the panel thats displayed in the Modal Popup:

<asp:UpdatePanel
ID="upnlAddExistingContact" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<asp:Panel ID="pnlAddExistingContact" runat="server" BackColor="WhiteSmoke" style="display:normal" BorderColor="Black" BorderStyle="Solid">
Add Existing Contacts
<br />
<asp:Panel ID="pnlContactGridView" runat="server" ScrollBars="Auto" HorizontalAlign="Center" Height="400" Width="1000">
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<asp:GridView
ID="GridView1" runat="server" AllowSorting="True" AutoGenerateColumns="False" BackColor="White" BorderColor="#999999" BorderStyle="None" BorderWidth="1px" CellPadding="3"
DataKeyNames="ID" DataSourceID="SqlDataSource3" GridLines="Vertical" Height="400px" Width="1000px" OnSorting="GridView1_Sorting">
<AlternatingRowStyle BackColor="#DCDCDC" />
<Columns>
<asp:TemplateField>
<ItemTemplate>
<asp:CheckBox ID="CheckBox1" runat="server" />
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="ID" InsertVisible="False" SortExpression="ID">
<EditItemTemplate>
<asp:Label ID="Label2" runat="server" Text='<%# Eval("ID") %>'></asp:Label>
</EditItemTemplate>
<ItemTemplate>
<asp:Label ID="lblIDGrid" runat="server" Text='<%# Bind("ID") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Name" SortExpression="Name">
<EditItemTemplate>
<asp:Label ID="Label1" runat="server" Text='<%# Eval("Name") %>'></asp:Label>
</EditItemTemplate>
<ItemTemplate>
<asp:Label ID="lblNameGrid" runat="server" Text='<%# Bind("Name") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:BoundField DataField="Title" HeaderText="Title" SortExpression="Title" />
<asp:BoundField DataField="JobFunction" HeaderText="Job Function" SortExpression="JobFunction" />
<asp:BoundField DataField="Phone_Work" HeaderText="Phone (Work)" SortExpression="Phone_Work" />
<asp:BoundField DataField="Phone_Home" HeaderText="Phone (Home)" SortExpression="Phone_Home" />
<asp:BoundField DataField="Phone_Mobile" HeaderText="Phone (Mobile)" SortExpression="Phone_Mobile" />
<asp:BoundField DataField="Email" HeaderText="Email" SortExpression="Email" />
</Columns>
<FooterStyle BackColor="#CCCCCC" ForeColor="Black" />
<HeaderStyle BackColor="#000084" Font-Bold="True" ForeColor="White" />
<PagerStyle BackColor="#999999" ForeColor="Black" HorizontalAlign="Center" />
<RowStyle BackColor="#EEEEEE" ForeColor="Black" />
<SelectedRowStyle BackColor="#008A8C" Font-Bold="True" ForeColor="White" />
<SortedAscendingCellStyle BackColor="#F1F1F1" />
<SortedAscendingHeaderStyle BackColor="#0000A9" />
<SortedDescendingCellStyle BackColor="#CAC9C9" />
<SortedDescendingHeaderStyle BackColor="#000065" />
</asp:GridView>
<asp:SqlDataSource ID="SqlDataSource3" runat="server" ConnectionString="<%$ ConnectionStrings:SQL2012_279191_cwgcrmConnectionString %>" SelectCommand="SELECT [ID], [FName] + ' ' + [LName] as [Name], [Title], [JobFunction], [Phone_Work], [Phone_Home], [Phone_Mobile], [Email] FROM [tblCustomer_Contact] WHERE ([fkCustomer] = @fkCustomer) ORDER BY [Name]">
<SelectParameters>
<asp:ControlParameter ControlID="ddlCustomer" DefaultValue="0" Name="fkCustomer" PropertyName="SelectedValue" />
</SelectParameters>
</asp:SqlDataSource>
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="GridView1" EventName="Sorting" />
<asp:AsyncPostBackTrigger ControlID="GridView1" EventName="Sorted" />
</Triggers>
</asp:UpdatePanel>
</asp:Panel>
<asp:Button ID="btnAddExistingContactSubmit" runat="server" Text="Add Contact" OnClick="btnAddExistingContactSubmit_Click" />
<asp:Button ID="btnAddExistingContactCancel" runat="server" Text="Cancel" OnClick="btnAddExistingContactCancel_Click" />
<asp:Button ID="btnEditContact" runat="server" OnClick="btnEditContact_Click" Text="Edit Contact" />
<asp:ModalPopupExtender
ID="mpeEditExistingContact" runat="server" Enabled="True"
TargetControlID="btnEditContact" PopupControlID="pnlEditExistingContact" CancelControlID="btnEditExistingContactCancel" OkControlID="btnEditExistingContactSubmit">
</asp:ModalPopupExtender>

</asp:Panel>
</ContentTemplate>
</asp:UpdatePanel>
</div>

Here's the updatepanel (it's the main page) that includes the Listbox:

<asp:UpdatePanel
ID="upnlCallReport" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<table class="auto-style1">
<tr>
<td class="auto-style5">Salesperson</td>
<td class="auto-style6">
<asp:DropDownList ID="ddlSalesperson" runat="server" Width="300px" DataSourceID="SqlDataSource1" DataTextField="Name" DataValueField="ID" AutoPostBack="True">
</asp:DropDownList>
<asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="<%$ ConnectionStrings:SQL2012_279191_cwgcrmConnectionString %>"
SelectCommand="SELECT [ID], [LName] + ', ' + [FName] as Name FROM tblSalesperson ORDER BY [Name]"></asp:SqlDataSource>
</td>
<td>&nbsp;</td>
</tr>
<tr>
<td class="auto-style5">Customer</td>
<td class="auto-style6">
<asp:DropDownList ID="ddlCustomer" runat="server" Width="300px" DataSourceID="SqlDataSource2" DataTextField="Name" DataValueField="ID" AutoPostBack="True">
</asp:DropDownList>
<asp:SqlDataSource ID="SqlDataSource2" runat="server"
ConnectionString="<%$ ConnectionStrings:SQL2012_279191_cwgcrmConnectionString %>"
SelectCommand="SELECT c_p.Name + ', ' + c_p.City + ', ' + c_p.State as Name, c_p.ID
FROM tblCustomer_Profile c_p
INNER JOIN tblCustomer_Salesperson c_sp
ON c_p.ID = c_sp.fkCustomerID
INNER JOIN tblSalesperson sp
ON c_sp.fkSalespersonID = sp.ID
WHERE getDate() BETWEEN c_sp.StartDate AND c_sp.EndDate AND sp.ID = @ID ORDER BY Name">
<SelectParameters>
<asp:ControlParameter ControlID="ddlSalesperson" Name="ID" PropertyName="SelectedValue" />
</SelectParameters>
</asp:SqlDataSource>
</td>
<td>&nbsp;</td>
</tr>
<tr>
<td class="auto-style5">Date</td>
<td class="auto-style6">
<asp:TextBox ID="txtDate" runat="server">
</asp:TextBox>
<asp:TextBoxWatermarkExtender ID="txtDateTextBoxWatermarkExtender" runat="server" Enabled="True" TargetControlID="txtDate" WatermarkText="mm/dd/yyyy" WatermarkCssClass="watermark">
</asp:TextBoxWatermarkExtender>
<asp:PopupControlExtender ID="txtDate_PopupControlExtender" runat="server" DynamicServicePath="" Enabled="True" ExtenderControlID="" PopupControlID="pnlCalendar" Position="Right" TargetControlID="txtDate">
</asp:PopupControlExtender>
</td>
<td>&nbsp;</td>
</tr>
<tr>
<td class="auto-style5">Contacts</td>
<td class="auto-style6">
<asp:ListBox ID="lbContacts" runat="server" Height="100px" Width="300px" BorderColor="#CCCCCC" BorderStyle="Ridge"></asp:ListBox>
</td>
<td>

<asp:Button ID="btnAddExistingContact" runat="server" Text="Add Existing Contact" OnClick="btnAddExistingContact_Click" />
<br />
<asp:Button ID="btnAddNewContact" runat="server" Text="Add New Contact" OnClick="btnAddNewContact_Click" />
</td>
</tr>
<tr>
<td class="auto-style5">Summary</td>
<td class="auto-style6">
<asp:TextBox ID="txtSummary" runat="server" Height="100px" Width="300px" BorderColor="#CCCCCC" BorderStyle="Ridge" TextMode="MultiLine"></asp:TextBox>
</td>
<td>&nbsp;</td>
</tr>
<tr>
<td class="auto-style5">Details</td>
<td class="auto-style6">
<asp:Panel ID="pnlDetails" runat="server" Height="200px" HorizontalAlign="Center" ScrollBars="Vertical" Width="300px" BorderColor="#CCCCCC" BorderStyle="Ridge">
</asp:Panel>
</td>
<td>
<asp:Button ID="btnAddNewDetail" runat="server" Text="Add New Detail" OnClick="btnAddNewDetail_Click" />
</td>
</tr>
</table>
<asp:Panel ID="pnlCallReport" runat="server">

<asp:Button ID="btnModalAddExistingContact" runat="server" Text="Modal Popup Control" style="display:none" />
<asp:Button ID="btnModalAddNewContact" runat="server" Text="Modal Popup Control" style="display:none" />
<asp:Button ID="btnModalEditExistingContact" runat="server" Text="Modal Popup Control" style="display:none" />
<asp:Button ID="btnModalAddNewDetail" runat="server" Text="Modal Popup Control" style="display:none" />

<asp:ModalPopupExtender
ID="mpeAddExistingContact" runat="server" Enabled="True"
TargetControlID="btnModalAddExistingContact" PopupControlID="pnlAddExistingContact" CancelControlID="btnModalAddExistingContact">
</asp:ModalPopupExtender>
<asp:ModalPopupExtender
ID="mpeAddNewContact" runat="server" Enabled="True"
TargetControlID="btnModalAddNewContact" PopupControlID="pnlAddNewContact" CancelControlID="btnModalAddNewContact">
</asp:ModalPopupExtender>
<asp:ModalPopupExtender
ID="mpeAddNewDetail" runat="server" Enabled="True"
TargetControlID="btnModalAddNewDetail" PopupControlID="pnlAddNewDetail" CancelControlID="btnModalAddNewDetail">
</asp:ModalPopupExtender>
<asp:Button ID="btnCallReportSubmit" runat="server" Text="Button" />
<asp:Button ID="btnCallReportCancel" runat="server" Text="Button" />
</asp:Panel>
</ContentTemplate>
</asp:UpdatePanel>


Unable to show loading image on ajaxstart and ajaxcomplete

$
0
0

Hi, I am unable to display the loading image during ajax calls, Below is my code. I am using kendo tab strip, generating dynamic html table and appending it to first div 'chart'.

<center><img id="loader" style="vertical-align: middle;height:70px;width:70px;" src="../../Content/Images/spinner.gif" /></center><div id="tabStrip"><ul><li class="k-state-active">
            Table</li><li>
            Chart</li></ul><div id="daily_div" style="overflow: auto;"><table id="daily_table"></table></div><div id="chart"><h2>Chart representation for @Request.QueryString["node"]</h2></div></div><script type="text/javascript">$("#tabStrip").kendoTabStrip({
        animation: {
            open: {
                effects: "fadeIn"
            }
        }
    });$(document).ajaxStart(function () {$("#loader").show();
    });$(document).ajaxComplete(function () {$("#loader").hide();
    });$(function () {
        // get nodequery variable
        var node= getQueryVariable("node");

        var qry_month = getQueryVariable("month");  

        var enb_array = node.split(',');

        var d = new Date();
        var month = d.getMonth();
        var main_dates = [];
        // if month in qry variable is equal to this month, for loop for todays date -1
        if (qry_month == (month + 1)) {
            // get todays date
            var dt = d.getDate();
            if ((month + 1) < 10) {
                month = "0" + (month + 1);
            }
            else {
                month = month + 1;
            }
            // add heading row...
            var heading_row = "<thead><tr><th></th><th></th>";
            for (var i = 1; i <= (dt - 1); i++) {
                var j;
                if (i < 10) {
                    j = "0" + i;
                }
                else {
                    j = i;
                }
                var data_heading = d.getFullYear() + "/" + month + "/" + j;
                main_dates.push(data_heading);
                heading_row += "<th style='width:500px;' id='" + data_heading + "'><b>" + data_heading + "</b></th>";
            }
            heading_row += "</tr></thead>";$('#daily_table').append(heading_row);
            //$('#loader').show();

            load_table(heading_row,enb_array, month, main_dates);    // if commented heading is being populated and loading gif is showing....
        }
        // else if month > this month display null

        else {
            alert("No data to display!");
        }

        // load high chart too...
    });

function load_table(heading_row, enb_array, month, main_dates) {
        var data_row = "" + heading_row;

            for (var enb = 0; enb < enb_array.length; enb++) {
                var enodeb = enb_array[enb];
                var url = decodeURIComponent("/Home/GetDates?enodeb=" + enodeb + "&month=" + month);
                url = url.replace(' ', '');
                //console.log(url);
                //$('#loader').show();$.ajax({
                    type: "GET",
                    url: url,
                    async: false,
                    dataType: "json",
                    contentType: "application/json;charset=utf-8",
                    success: function (response) {
                        //$('#loader').hide();
                        console.log(JSON.stringify(response));      // comment later
                        // alert(response.length);
                        for (var i = 0; i < response.length; i++) {
                            var obj = response[i];
                            //..... generate data_rows for table
                            // end of for key obj
                        }   // end of for response.length

                        // find heading and compare with DateUTC, if equal insert data else insert'null' and skip


                        data_row += "<tr><td><a target='_blank' href='GenerateChart?node=" + node + "'><b>" + node + "</b></b></td></tr>";
                        //console.log(data_row);
                        for (var met = 0; met < metrics.length; met++) {
                            // ...generate data row

                            for (var i = 0; i < main_dates.length; i++) {
                                var pos = $.inArray(main_dates[i], DateUTC_array);
                                if (pos != -1) {
                                    // insert values
                                    switch (metrics[met]) {
                                    }
                                }
                                else {
                                    // insert '-'
                                    data_row += "<td><b> - </b></td>"
                                }

                            } // end of main_dates for
                            data_row += "</tr>";
                        }



                    },   // end of success
                    complete: function () {
                        document.getElementById("daily_table").innerHTML = data_row;
                        //$('#loader').hide();
                    }


                }); //end of ajax call              


            }   //end of for enb length
            //data_row += "</table>";

            //$('#daily_table').append(data_row);
            console.log(data_row);

        }

The multiple ajax calls is taking time, so I want to display a loading gif while the page loads completely...

Any help appreciated!!Thanks!!

Ajax Control Toolkit - Autocomplete help

$
0
0

I am using the autocomplete on a textbox and executing sql based on the user entry.  This is all working fine.  What I need to do is if a user enters "Tom Jo" and the suggested item "Tom Jones" is selected,  it replaces the "Jo" that was typed with the "Tom Jones" leaving the part before the space "Tom" in the textbox -- so they end up with "Tom Tom Jones".

I am needing any text in the textbox to be cleared if they select an item from the suggestion.  Any suggestions?

Appreciate any feedback!

Passing multiple parameters to AJAX call

$
0
0

I'm trying to pass two parameters to the url in my Ajax call and it's not working. What is wrong with my format?  Thank you

function getData() 
            {
            return $.ajax({
                    url: "/Books/GetBookList/" + "<%=ca.ID%>" + "&<%=ca.Title%>",
                    type: "GET", 
                    dataType: "json",
                    success: ShowBooks,
                    error: function (jqXHR, textStatus, errorThrown) { 
                    }
                 });
                }


String Manipulation

$
0
0

Hello, I am trying to clean-up a string, replace all special characters with "-" and then remove all duplicate hyphens except the first one. I need to create a function for this.

Original String:  "State cultural festivals & % ??? .. and music"

Clean string should look like this: State-cultural-festivals-and-music 

I got into cleaning all special characters but struggling to remove repeated hyphens except the first character. My current code is below. Any help would be appreciated.

  Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load

        Dim MyString As String = "State cultural festivals & % ??? .. and music"
        MsgBox(Trim(CleanInput(MyString)))
    End Sub
    Public Function CleanInput(strIn As String) As String
        Try
            Dim returnStr As String
            returnStr = Regex.Replace(strIn, "[^\w\.@-]", "-")
            returnStr = Trim(returnStr)
            returnStr = returnStr.Replace(",", "-")
            returnStr = returnStr.Replace(".", "-")
            Return returnStr

        Catch ex As Exception
            Return String.Empty
        End Try
    End Function
End Class

Current Output: 
State-cultural-festivals------------and-music

UpdatePanel, GridView, and PostBack

$
0
0
I have what I think is a fairly common scenario.  I'm implementing ATLAS into my current web application.  I've added an UpdatePanel around my GridView.  Everything is great, except I have a ButtonField that executes some server-side code and causes a PostBack.  This is desired, I've got a few things going on here and want the PostBack, but the UpdatePanel wants to do its thing and stops the PostBack from occuring.

Is there any way to bypass this?  Or... what are my alternatives?  Do I have to abandon the UpdatePanel and all the rich features it just added for me?

Thanks for your assistance.

Removing Toolkit leads to MsAjaxBundle is not a valid script name

$
0
0

I added the Ajax Toolkit to my solution in VS Express 2013 using NuGet. I followed the instructions of Walther's blog to edit the master page to change scriptmanager to the toolkitscriptmanager while commenting out the reference to MsAjaxBundle. Now, I have decided to uninstall the toolkit using NuGet and changed the master page back to it's original version including adding the line back in for <asp:ScriptReference name="MsAjaxBundle" />. Now, when running the site, I get the error 'MsAjaxBundle' is not a valid script name. The name must end in .js. I never used the tookit so none of my pages reference it. The assembly was registered in web.config but has been removed. I compared pertinent files in this solution to a blank solution, and I can't find any differences. Any ideas?

ajax call not working for some users

$
0
0

Hi,

We have an ASP.NET web application, and this application makes AJAX call using "ajaxToolkit:ToolkitScriptManager". The functions work for some users, but does not work for other users. All users use the same version of IE and Firefox. This website is the same for all users. Any ideas about it? Thanks!


Null Reference for PopupControlExtender

$
0
0

Hello,

I am attempting to a web page as a popup via Ajax PopupControlExtender but having some difficulty. When attempting to show the popup, the following error is returned:

"JavaScript runtime error: Unable to get property 'showPopup' of undefined or null reference"

I've tried to access the control by way of the BehaviorID, ClientID and ControlBehavior (I.e. AjaxControlToolkit.PopupControlBehavior.__VisiblePopup.showPopup(); )

but to no avail. There are a few odd things occurring that maybe worth mentioning:

1.  I am able to show a non-modal popup with Ajax PopupControlExtender in other pages using the BehaviorID

2. I am able to show a Modal popup (I.e. ModalPopupExtender) from the page in question with no problem.

3. Other controls in the page can be accessed with ClientID. It's just the PopupControlExtender control whereby the null reference is returned.

Here's a sample of the code:

<cc1:PopupControlExtender ID="test1_PopupControlExtender" 
        runat="server" DynamicServicePath="" Enabled="True" ExtenderControlID="" 
        TargetControlID="Label1" PopupControlID="test1"></cc1:PopupControlExtender>$find('test1').showPopup();
    //AjaxControlToolkit.PopupControlBehavior.__VisiblePopup.showPopup();
    //$find('<%=form1.FindControl("test1_PopupControlExtender").ClientID%>').showPopup();   

Any help is appreciated.

Web forms web service Url routing

$
0
0
Hello, trying to route the URL of an asmx file in my webforms app, but have had no luck. I implemented the interface listed here, but either get a 500 or 404 error from my Ajax call. http://evolpin.wordpress.com/2012/12/30/net-4-url-routing-for-web-services-asmx/ . Does anyone know of a way to route this URL as site/webservice for webservice.mymethod(params)? Any help is appreciated. Thanks!

In AJAX partial update of the page so ListBox1 only will be updated not the whole page

$
0
0

I have some SQL code I want to run when Timer2 fires. 

How do I do this in the AJAX partial update of the page so ListBox1 only will be updated not the whole page?

<asp:UpdatePanel ID="UpdatePanel2" runat="server"><Triggers><asp:AsyncPostBackTrigger ControlID="Timer2" EventName="Tick" /></Triggers><ContentTemplate><asp:Timer ID="Timer2" Interval="30000" runat="server"></asp:Timer><asp:ListBox ID="ListBox1" Width="500" Height="100" runat="server"></asp:ListBox></ContentTemplate></asp:UpdatePanel>

UpdatePanel broken after moving from .NET Framework 3.5 to 4.0

$
0
0

Dear ACT experts,

I upgraded a fairly large and complex ASP.NET application from .NET Framework 3.5 to 4.0. I also upgraded AjaxControlToolKit to the suggested one for .NET Framework 4.0 (4.1.7.1213). Unfortunately UpdatePanel control seems to be broken now, as the upgraded version is not updating the client side HTML after a change; client side js processing fails with 2 different JS errors instead.

On server side, the UpdatePanel is set to ChildrenAsTriggers="true", so I expect an ajax postback on any content control change.

I've done the following inspection so far with IE Dev Tools (We are using IE8):

There are 2 cases:

A) Accessing the application with localhost url.

B) Accessing the application with fully qualified machinename. In this case, request and response goes through a proxy chain (which should also work).

Behavior is slightly different in both cases.

Case A

Response is seemingly OK (compared to the 3.5 version), but client side js fails with the following error:

Webpage error details

User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; WOW64; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; .NET4.0C; .NET4.0E; MS-RTC LM 8; Unicredit)

Timestamp: Thu, 17 Jul 2014 14:04:45 UTC

Message: Sys.InvalidOperationException: Could not find UpdatePanel with ID ''. If it is being updated dynamically then it must be inside another UpdatePanel.

Line: 940

Char: 13

Code: 0

URI: http://....../ScriptResource.axd?d=JGIMCka_B5hCdOL4f5noKcijd_067NQh-TVAcdr5nOkoUF17sUEEEQiID6euG8T-0_WwgPLUKTcFEg5c-UK-W66PDOyWG6OglkaKleiolJ6NG1NmahW-8_a8KDZnMM5vWLT1vTpg2WfithU4PIjXjPKHBqU1&t=51e37521

(this scriptresource.axd call points to MicrosoftAjaxWebForms.debug.js (4.1.7.1213)). This error message is fairly misleading as it complains about some nested UpdatePanel (which I don't have any), and the reality is that it fails at trying to iterate through the enlisted UpdatePanel content (of which there are 8, but really there are only 4, but the code seems to ignore the even ones if it goes with version4). See the for cycle in _onFormSubmitCompleted method at line 1433 in MicrosoftAjaxWebForms.debug.js (4.1.7.1213).

I was curious, and in this case I've tried to amend the response with the following string on the start: "1|#||4|", because somehow it seems to expect something like this, and it fixed the client side operation, the script updated the HTML properly! My problem is, that I don't know how to put this string at the start of the response automatically (neither I think that it'd be my task...).

Case B

Response starts with the ominous "4|#||4|" (which is bad, as the first number should show that how long the content of this part must be), but compared to case A, important parts are missing too. This case, the MicrosoftAjaxWebForms.debug.js (4.1.7.1213) throws error at _parseDelta line 1554, because 

if (reply.charAt(replyIndex) !== '|') { 

at line 1543 returns false and it fills the parserErrorDetails (hence, call to _endPostBack with error and return null).

Additional information: important part of web.config is the following:

<?xml version="1.0" encoding="UTF-8"?><configuration><system.web.extensions><scripting><webServices><jsonSerialization maxJsonLength="5000000" /></webServices><scriptResourceHandler enableCompression="false" enableCaching="true" /></scripting></system.web.extensions><system.web><machineKey validationKey="..." decryptionKey="..." validation="SHA1" decryption="AES" /><compilation defaultLanguage="c#" debug="true"/><customErrors mode="Off" /><authentication mode="Forms"><forms loginUrl="Logon.aspx?Redirect=true" name="adAuthCookie" timeout="60" path="/" /></authentication><authorization><deny users="?" /><allow users="*" /><!-- Allow all users --><!--  <allow     users="[comma separated list of users]"
                             roles="[comma separated list of roles]"/><deny      users="[comma separated list of users]"
                             roles="[comma separated list of roles]"/>
            --></authorization><trace enabled="false" requestLimit="10" pageOutput="false" traceMode="SortByTime" localOnly="true" /><sessionState mode="InProc" stateConnectionString="tcpip=127.0.0.1:42424" sqlConnectionString="data source=127.0.0.1;Trusted_Connection=yes" cookieless="false" timeout="120" /><globalization requestEncoding="utf-8" responseEncoding="utf-8" /><pages clientIDMode="AutoID"><controls><add tagPrefix="asp" namespace="System.Web.UI" assembly="System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" /><add tagPrefix="asp" namespace="System.Web.UI.WebControls" assembly="System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" /><add tagPrefix="act" namespace="AjaxControlToolkit" assembly="AjaxControlToolkit" /></controls></pages><httpHandlers><remove verb="*" path="*.asmx" /><remove verb="*" path="*_AppService.axd" /><remove verb="GET,HEAD" path="ScriptResource.axd" /><add verb="*" path="*.asmx" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" /><add verb="*" path="*_AppService.axd" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" /><add verb="GET,HEAD" path="ScriptResource.axd" validate="false" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" /></httpHandlers><healthMonitoring><rules><add name="Application Lifetime Events Default" eventName="Application Lifetime Events" provider="EventLogProvider" profile="Default" minInstances="1" maxLimit="Infinite" minInterval="00:01:00" custom="" /><add name="All Errors Default" eventName="All Errors" provider="EventLogProvider" profile="Default" minInstances="1" maxLimit="Infinite" minInterval="00:01:00" custom="" /></rules></healthMonitoring></system.web><appSettings><add key="aspnet:MaxHttpCollectionKeys" value="2000" /></appSettings><system.webServer><httpProtocol><customHeaders><clear /><add name="X-UA-Compatible" value="IE=EmulateIE7" /></customHeaders></httpProtocol><validation validateIntegratedModeConfiguration="false" /><modules><remove name="ScriptModule" /><add name="ScriptModule" preCondition="managedHandler" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" /></modules><handlers><remove name="WebServiceHandlerFactory-Integrated" /><remove name="ScriptHandlerFactory" /><remove name="ScriptHandlerFactoryAppServices" /><remove name="ScriptResource" /><add name="ScriptHandlerFactory" verb="*" path="*.asmx" preCondition="integratedMode" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" /><add name="ScriptHandlerFactoryAppServices" verb="*" path="*_AppService.axd" preCondition="integratedMode" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" /><add name="ScriptResource" verb="GET,HEAD" path="ScriptResource.axd" preCondition="integratedMode" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" /></handlers><urlCompression doStaticCompression="true" doDynamicCompression="true" /></system.webServer><runtime><assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"><dependentAssembly><assemblyIdentity name="AjaxControlToolkit" publicKeyToken="28f01b0e84b6d53e" /><bindingRedirect oldVersion="3.0.0.0-4.0.0.0" newVersion="4.1.7.1213" /></dependentAssembly></assemblyBinding></runtime></configuration>


Case A response header:

HTTP/1.1 200 OK
Cache-Control: no-cache
Pragma: no-cache
Content-Type: text/plain; charset=utf-8
Expires: -1
Vary: Accept-Encoding
Server: Microsoft-IIS/7.5
X-AspNet-Version: 4.0.30319
X-UA-Compatible: IE=EmulateIE7
Date: Thu, 17 Jul 2014 14:03:12 GMT
Content-Length: 186227

Case B response header:

HTTP/1.0 200 OK
Cache-Control: no-cache
Pragma: no-cache
Content-Length: 151464
Content-Type: text/plain; charset=utf-8
Expires: -1
Server: Microsoft-IIS/7.5
X-AspNet-Version: 4.0.30319
X-UA-Compatible: IE=EmulateIE7
Date: Thu, 17 Jul 2014 14:07:37 GMT
X-Cache: MISS from x.x.x.x
X-Cache-Lookup: MISS from x.x.x.x:8080
X-Cache: MISS from drop20
X-Cache-Lookup: MISS from y:8080
Via: 1.0 y.x.x.x (squid/3.1.10)
Connection: keep-alive

Things that I've tried and not worked:

  • code inspection for Response.Write, Response.Redirect, Server.Transfer (none of them used during the client-server roundtrip)
  • various web.config pimps for handlers/modules
  • turn IIS compression off
  • remove httpModules from web.config
  • downgrade AjaxControlToolkit to some older version (3.5, 3.0)

Any ideas?

K

ModalPopupExtender keep open

$
0
0

I have a ModalPopupExtender on a master page that makes a Panel visible when I click a button.  I have a checkbox in the Panel that is used in the query to display different rows in the GridView inside the Panel.  However, when I click the checkbox the panel disappears.  How do I keep the Panel visible and just Databind the GridView?  Code is below.

<asp:Button ID="LBtnChooseClient" runat="server" Text="Select or add a Client" Font-Size="Medium"></asp:Button><asp:ModalPopupExtender ID="ModalPopupExtender1" runat="server" PopupControlID="PanelPickPatient" 
                        TargetControlID="LBtnChooseClient" BackgroundCssClass="popUpStyle" 
                        DropShadow="True" RepositionMode="RepositionOnWindowResize"></asp:ModalPopupExtender> <asp:Panel ID="PanelPickPatient" runat="server" style="display:none;z-index:100000" BackColor="#FFFFFF" ScrollBars="Auto" Height="400"><table width="400" style="background-color: #FFFFFF"><tr><td><asp:Label ID="LblSelect" runat="server" Text="Select from list or " Font-Size="10pt" ForeColor="Blue"></asp:Label><asp:LinkButton ID="LBtnNewClient" runat="server" Text="Add a Client"></asp:LinkButton></td><td align="center"><asp:CheckBox ID="ckActiveOnly" runat="server" Text="Active" 
                        Checked="True" AutoPostBack="True" /></td><td align="right"><asp:LinkButton ID="LBtnCancelSelect" runat="server" Text="Cancel"></asp:LinkButton></td></tr></table><asp:GridView ID="gvPatients" runat="server" AutoGenerateColumns="False" 
            DataKeyNames="PatientID" DataSourceID="SqlselPatientsOneorg" 
            CellPadding="4" ForeColor="#333333" GridLines="None" ShowFooter="True"><RowStyle  CssClass="gridrow" /><Columns><asp:TemplateField HeaderText="Client Name"><ItemTemplate><asp:LinkButton ID="LBtnLastFirst" runat="server" ToolTip="click to select" 
                            Text='<%# Eval("LastFirst") %>' CausesValidation="False" CommandName="Select"></asp:LinkButton></ItemTemplate></asp:TemplateField><asp:BoundField DataField="DOB" DataFormatString="{0:d}" HeaderText="DOB" 
                    SortExpression="DOB" /><asp:TemplateField HeaderText="Unverified Meals" ItemStyle-HorizontalAlign="Center"><ItemTemplate><asp:LinkButton ID="LBtnUnverifiedMeals" runat="server" Text='<%# Eval("UnverifiedMeals") %>' 
                            CommandName="unmeals" CommandArgument='<%# Eval("PatientID") %>'></asp:LinkButton></ItemTemplate></asp:TemplateField><asp:TemplateField HeaderText="Unverified Snacks" ItemStyle-HorizontalAlign="Center"><ItemTemplate><asp:LinkButton ID="LBtnUnverifiedSnacks" runat="server" Text='<%# Eval("UnverifiedSnacks") %>' 
                            CommandName="unsnacks" CommandArgument='<%# Eval("PatientID") %>'></asp:LinkButton></ItemTemplate></asp:TemplateField><asp:TemplateField><ItemTemplate><asp:Label ID="LblPatientID" runat="server" Text='<%# Eval("PatientID") %>' CssClass="Hide"></asp:Label>    <asp:Label ID="LblAge" runat="server" Text='<%# Eval("Age") %>' CssClass="Hide"></asp:Label>    </ItemTemplate></asp:TemplateField></Columns><FooterStyle CssClass="gridfoot" /><PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center" /><SelectedRowStyle BackColor="#FFFF99" Font-Bold="True" ForeColor="#333333" /><HeaderStyle CssClass="gridhead" /><EditRowStyle BackColor="#999999" /><AlternatingRowStyle CssClass="gridaltrow" /></asp:GridView><asp:SqlDataSource ID="SqlselPatientsOneorg" runat="server" 
            ConnectionString="<%$ ConnectionStrings:KetodataConnectionString %>" 
            SelectCommand="kd_selPatientsOneOrg" SelectCommandType="StoredProcedure"><SelectParameters><asp:CookieParameter Name="OrgID" CookieName="OrgID" Type="Int32" /><asp:ControlParameter Name="ActiveOnly" ControlID="ckActiveOnly" Type="Boolean" /></SelectParameters></asp:SqlDataSource></asp:Panel>

Viewing all 5678 articles
Browse latest View live




Latest Images