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

Ajax controls do not appear to work

$
0
0

I have created a simple aspx page in VB with a dropdown list so that when an entry is selected from the list a label is populated with the selected value. I have added Ajax Controls to see the 'flicker-free' effect when the list item is selected. The code is as follows:-

        <asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager>
        <asp:Label ID="Label1" runat="server" Text="Test Field"></asp:Label>
        <asp:TextBox ID="TextBox1" runat="server" Width="50px"></asp:TextBox>       
        <br />
        <asp:Label ID="Label2" runat="server" Text="Destinations"></asp:Label>
        <br />
        <asp:UpdatePanel ID="UpdatePanel1" runat="server">
            <ContentTemplate>
                <asp:DropDownList ID="DropDownList1" runat="server" OnTextChanged="PopulateCity">
                    <asp:ListItem Selected="True">London</asp:ListItem>
                    <asp:ListItem>Edinburgh</asp:ListItem>
                    <asp:ListItem>Manchester</asp:ListItem>
                    <asp:ListItem>Birmingham</asp:ListItem>
                    <asp:ListItem>Sheffield</asp:ListItem>
                    <asp:ListItem>Glasgow</asp:ListItem>
                </asp:DropDownList>
            </ContentTemplate>
        </asp:UpdatePanel>

        <br />
        <asp:Label ID="lblSelectedCity" runat="server" Text="Selected City"></asp:Label>

The associated .vb file contains the instruction to populate the label as follows:-
    Public Sub PopulateCity()
        lblSelectedCity.Text = DropDownList1.SelectedValue
    End Sub
All very simple. I have run with and without autopostback on the dropdownlist but get the same result.using

I am using Visual Studio 2015 Enterprise running under Windows 10. Unfortunately, although the page compiles correctly it fails to load in IIS and fails with a Script error as follows:-
JavaScript critical error at line 1, column 1 in about:/WebResource.axd?d=pynGkmcFUV13He1Qd6_TZPtgUzshvNOrzBY02HNzwTWPgIUPSB8j6fqCs84jIC1ciFRWqTMUCIPk1rfsjGRGmw2&t=635817807509396181\n\nSCRIPT1002: Syntax error

The web.config file contains the basic entries as per a new website so I'm wondering if some entries relating to Ajax are missing or if the problem lies in the IIS configuration which I have never touched in the past 4 or 5 years I have been developing websites.

Any help would be appreciated, thank you.

Update

I have run the Microsoft Sample at https://msdn.microsoft.com/en-us/library/cc295469.aspx by copying the code into an aspx web form and have got exactly the same result which suggests a configuration problem. Again, any help would be appreciated. 

Further Update

I have loaded the copied code/aspx page to my personal website and it works! I think this narrows the problem down further - to ISS configuration on my PC. If anyone knows where I start looking again I would appreciate the help.


Ajax to retrieve data from database

$
0
0

I've got a web form where I'm creating a couple of textboxes dynamically using jquery. I also need to build a dropdown list from a database call using jquery.

I created a test project and got the code working but when I moved over it into the development project, I'm having issues with the ajax section of the code. It fails and I get the error alert. 

Here's the jquery/ajax:

<script type="text/javascript">$(document).ready(function () {$("#btnAdd").click(function () {

                var newRow2 = "<br /><label>Additional Issue: </label><br /><input type='text' size='50' name='addIssue' id='field' value='' /><br /><br /><label>Description:</label><br /><textarea rows='8' cols='80' name='addProblem' id='field' ></textarea><br /><br />"$('#controls').append(newRow2);$.ajax({
                    url: "GetCategory.asmx/HelloWorld",
                    dataType: "json",
                    type: "POST",
                    data: "{}",
                    contentType: "application/json; charset=utf-8",
                    success: function (data) {
                        alert(data.d)$('#controls').append("Category:" + data.d + "<br /><br />");

                    },
                    error: function () {
                        alert("Ajax Error");
                    }
                });
            });
        });</script>

And here is the code in the asmx file:

Imports System.Web.Services
Imports System.Web.Services.Protocols
Imports System.ComponentModel

' To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line.
' <System.Web.Script.Services.ScriptService()> _<System.Web.Services.WebService(Namespace:="http://tempuri.org/")> _<System.Web.Services.WebServiceBinding(ConformsTo:=WsiProfiles.BasicProfile1_1)> _<ToolboxItem(False)> _
Public Class GetCategory
    Inherits System.Web.Services.WebService<WebMethod()> _
    Public Function HelloWorld() As String
       Return "Hello World"
    End Function

End Class

When I run this, the ajax call comes back with an error. (Yeah, I scaled down the code to see if I could retrieve anything)

I've tried using the ajax call with the asmx file as well as the .vb file of the webform. I've tried using 

<%=ResolveUrl("~/GetCategory.asmx/HelloWorld") %>

as the url of the ajax url in addition to what I used above.

I'm stumped. It's as if the service can't be found or the function can't be found. Any thoughts?

why does claring my URL Stack cause a delay in page reponsiveness ?

$
0
0

Hi ,

I have the following in the server side code. Note the closeURLStack is defined as follows

public Stack CloseURLStack
{
get { return stkCloseURL; }
set { this.stkCloseURL = value; }
}

[WebMethod]
[ScriptMethod()]
public static bool ClearCallStack()
{
   if (userContext != null && userContext.CloseURLStack != null && userContext.CloseURLStack.Count > 0)
      userContext.CloseURLStack.Clear();
     return true;
}

It is called from javascript via the following


function ActionMenuItemClick(e) {
PageMethods.ClearCallStack();
}

It seems that when the user clicks on a menu then there is no responsiveness for about 8 or so seconds and then the page renders . 

If i comment out the PageMethos.ClearacALLsTACK()  it seems to be a bit faster. 

Question is do I need to clear the url stack or is there a better way of doing this ?

Thanks

how to get suggestions for of Phone numbers.

$
0
0

I dont know the ajax at all ..

my query is simple how to get suggestions of telephone numbers.

and if you have some more time tell me how to learn ajax ... i tried many websites they are very confusing .

thanks 

Ajax Control toolkit ComboBox MaxDropDownItems setting has no effect

$
0
0

I am attempting to limit the number of visible list items in an Ajax ComboBox control.  I thought the MaxDropDownItems property was supposed to accomplish this for me but has no effect on the control when rendered in a browser.  The following code snippet shows the properties I have defined for the control:

<ajaxToolkit:ComboBox ID="ComboBox1" runat="server"

              DataSourceID="SqlDataSource1"

              DataTextField="FullName"

              DataValueField="Record_ID#"

              OnSelectedIndexChanged="ComboBox1_SelectedIndexChanged"

              AutoCompleteMode="Suggest"

              AutoPostBack="True"

              ClientIDMode="Static"

              Height="22px"

              TabIndex="1"

              MaxDropDownItems="5">

</ajaxToolkit:ComboBox>

It does not seem to matter what what value I use for the MaxDropDownItems property.  There is no effect on the rendered control. 

Suggestions would be greatly appreciated.

Modal popup frozen and getting postback or call back argument error.

$
0
0

Im calling the modal popup which is placed inside the user control and calling the sales force related logic inside the button click event of modal popup.

hiding the modal popup when the operation is completed or getting error.  while getting the error the popup is in frozen state and not hiding even i close the popup and in the success case hiding the popup is working.

Issue 1:  how to close the popup.

tried to  closed the popup while exception occurs  in the update panel end request handler and now it hides.

Issue2: when i click the button inside the modal popup second time  it causes the Invalidpostback or call back argument error.

if there is no exception inside popup everything works fine.

Please let me know how to handle this issue.

My slideshowextender is not changing the images what should i do

$
0
0

I have a dynamic slide show on my website but it is not changing the images plzz help

my code for html::

<%@ Page Title="" Language="C#" MasterPageFile="~/Site1.Master" AutoEventWireup="true" CodeBehind="Garba_competition.aspx.cs" Inherits="spandan.Garba_competition" %>

<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">

<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>

<asp:Image ID="Image1" runat="server" />
<asp:SlideShowExtender ID="Slideshowextender1" runat="server"
Loop="true"
PreviousButtonID="prevButton"
AutoPlay="true"
SlideShowServiceMethod="GetSlides"
NextButtonID="nextButton"
PlayButtonID="playButton"
TargetControlID="Image1"

PlayButtonText="Play"
StopButtonText="Stop"
UseContextKey="True" />

<asp:Button runat="Server" ID="prevButton" Text="Prev" Font-Size="Medium" />
<asp:Button runat="Server" ID="playButton" Text="Play" Font-Size="Medium" />
<asp:Button runat="Server" ID="nextButton" Text="Next" Font-Size="Medium" />

</asp:Content>

and code for aspx.cs page::

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using AjaxControlToolkit;
using System.Data;
using System.Data.SqlClient;

namespace spandan
{
public partial class Garba_competition : System.Web.UI.Page
{
DataConnect obj
= new DataConnect();

protected void Page_Load(object sender, EventArgs e)
{


loadslide();

}



protected void loadslide()
{
string q = "SELECT * FROM Image_master";
DataSet ds2;
ds2 = new DataSet();
ds2 = obj.LoadData(q);


if (ds2.Tables[0].Rows.Count > 0)
{
AjaxControlToolkit.Slide[] slides = new AjaxControlToolkit.Slide[ds2.Tables[0].Rows.Count];

for (int i = 0; i < ds2.Tables[0].Rows.Count ; i++)
{

DataRow dr = ds2.Tables[0].Rows[i];
slides[i] = new AjaxControlToolkit.Slide();

// SlideShowExtender.SlideShowServiceMethod="Getslides(Convert.ToString(i))";

if (ds2.Tables[0].Rows.Count > 0 )
{
Image1.ImageUrl = ds2.Tables[0].Rows[i]["Image_url"].ToString();
}

}

//SlideShowExtender1.slides() = ds2.Tables[0];
// SlideShowExtender1.DataBind();

}
}



}
}

Modal Header and Footer not Rendered

$
0
0

I have a modal in my _Layout.cshtml like so:

<!-- Modal --><div class="modal fade" id="feedbackModal" tabindex="-1" role="dialog" aria-labelledby="feedbackModalLabel"><div class="modal-dialog" role="document"><div class="modal-content"><div class="modal-header"><button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button><h4 class="modal-title" id="feedbackModalLabel">Feedback</h4></div><div class="modal-body"><div id="feedbackDiv"></div></div><div class="modal-footer"><button type="button" class="btn btn-default" data-dismiss="modal">Close</button></div></div></div></div>

And I have an Ajax.ActionLink on the nav in _LoginPartial:

@Ajax.ActionLink("Feedback", "action", "controller", new AjaxOptions()
            {
                HttpMethod = "GET",
                InsertionMode = InsertionMode.Replace,
                UpdateTargetId = "feedbackDiv"
            }, new { @data_target = "#feedbackModal", @data_toggle = "modal" }) 

This hits an action in the controller and returns a partial view.

public PartialViewResult FeedbackPartial()
        {
            return PartialView("FeedbackPartial");
        }

This works and populates the modal, however the header and footer are not rendered. Hit F12 to inspect and the HTML has not been produced. Any ideas as to what's going wrong?

Thanks in advance
Adam


how to use update panel inside listview

$
0
0

when i use update panel inside listview triggered by radiobuttonlist inside listview,page  always postback , and i donot want that, i want to prevent page reload when radiobutton selected .

how can i solve it .
this code i use

<asp:ListView ID="ColorListView" runat="server" DataSourceID="ProductColorsDS" OnItemCommand="ColorListView_ItemCommand"><ItemTemplate><asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional"><ContentTemplate><asp:RadioButtonList ID="RadioButtonList1" runat="server" RepeatDirection="Horizontal" OnSelectedIndexChanged="RadioButtonList1_SelectedIndexChanged"></asp:RadioButtonList></ContentTemplate><Triggers><asp:PostBackTrigger ControlID="RadioButtonList1" /></Triggers></asp:UpdatePanel><asp:UpdatePanelAnimationExtender runat="server" ID="UPextender" TargetControlID="UpdatePanel1" BehaviorID="animation"><animations><OnUpdating><%-- It should take 1/2 of a second to fade out --%><FadeOut Duration=".5" Fps="20" minimumOpacity=".1" /></OnUpdating><OnUpdated><%-- It should take 1 and 1/2 of a second to fade back in --%><FadeIn Duration="1.5" Fps="20" minimumOpacity=".1" /></OnUpdated></animations></asp:UpdatePanelAnimationExtender></ItemTemplate><LayoutTemplate><tr runat="server" id="itemPlaceholder"></tr></LayoutTemplate></asp:ListView></div></div><asp:ObjectDataSource ID="ProductColorsDS" runat="server" OldValuesParameterFormatString="{0}" SelectMethod="Read" TypeName="BOL.ProductsColorsImages"><SelectParameters><asp:Parameter DefaultValue="2" Name="ActionCode" Type="String" /><asp:QueryStringParameter DefaultValue="" Name="ProductID" QueryStringField="ProductID" Type="Int32" /><asp:Parameter Name="ColorID" Type="Int32" /></SelectParameters></asp:ObjectDataSource>

which one is better JQuery Ajax or Ajax Control toolkit?

$
0
0

Hello everyone,

I am a beginner of asp.net platform.

I want to use ajax in my new project. So i want to know which one should be better  Ajax using JQuery or  asp.net built in ajax control.

I want to use Jquery for front end view. But is it better to use Jquery Ajax?

If can explain with example, i will be better for me to understand.

Thank You.

XmlTextReader - need to provide a User-Agent header to HTTP request

$
0
0

In an ASP.Net app (Visual Studio 2010 - VB.net) web application;

I need to add User-Agent header info to a call to a National Weather Service website \ XML file, and I'm not sure how to add this to my apps code.

Apparently the NWS has added this requirement recently, and it has disabled an application that I have had in service for several years.

"...Applications accessing resources on weather.gov need to provide a User-Agent header in any HTTP request. Requests without a user agent are automatically blocked...." "...We recommend providing a user agent string in the following format:   ApplicationName/vX.Y (http://your.app.url/; contact.email@example.com) ..."

...Well that's just great thanks NWS.

So, my existing code  is very simple

Dim xtrNWSFeed As XmlTextReader

Try    xtrNWSFeed = New XmlTextReader(strWeatherSrcFilePath)

Currently (in code I have omitted for brevity) strWeatherSrcFilePath is assembled to look like this:http://w1.weather.gov/xml/current_obs/KMCI.xml

...Further down in the code I simply begin to read the XML file

Try   While xtrNWSFeed.Read()   If XmlNodeType.Element Then    If xtrNWSFeed.Name = "location" Then

' go to its text node strLocation = (xtrNWSFeed.ReadString)

... and so on...

 I can't find where to place the User-Agent header information that the NWS now requires.

Loader not working

$
0
0

in my project i add a loader but it dos't work my code is

<asp:UpdateProgress ID="UpdateProgress1" runat="server" AssociatedUpdatePanelID="UpdatePanel1">
<ProgressTemplate>
<div style="position: fixed; text-align: center; height: 100%; width: 100%; top: 0; right: 0; left: 0; z-index: 9999999; background-color: #000000; opacity: 0.7;">
<asp:Image ID="imgUpdateProgress" runat="server" ImageUrl="../assets/ajax-loader.gif"
AlternateText="Loading ..." ToolTip="Loading ..." Style="padding: 10px; position: fixed; top: 45%; left: 50%;" />Loading ...
</div>
</ProgressTemplate>
</asp:UpdateProgress>

Updating Textbox on File Upload

$
0
0

I have a AjaxFileUpload control on my page which successfully uploads file when its default upload button is clicked.

Later on, I thought of adding a textbox which would show the name of the file uploaded.

<asp:ScriptManager ID="ToolkitScriptManager1" runat="server"> </asp:ScriptManager><asp:AjaxFileUpload ID="AjaxFileUpload1" runat="server"
        OnUploadComplete="AjaxFileUpload1_OnUploadComplete"
        MaximumNumberOfFiles="1"
        AllowedFileTypes="pdf"/><asp:UpdatePanel ID="UpdatePanel1" runat="server"><ContentTemplate><asp:TextBox ID="FileTxtBox" runat="server" /></ContentTemplate></asp:UpdatePanel>

In codebehind,

protectedvoidAjaxFileUpload1_OnUploadComplete(object sender,AjaxFileUploadEventArgs file){string fileName =Path.GetFileNameWithoutExtension(file.FileName);FileTxtBox.Text= fileName;UpdatePanel1.Update();}

Do I need to do anything extra for the textbox to show the file? Please suggest.

Thank you

Progress Bar not working on Production machine

$
0
0

I have a Progress Bar in an update panel which runs while a background process completes.  When I run the web page on my Devel machine the Progress Bar displays correctly, but when I upload the site to my Prod machine it no longer works.  The image is displayed but nothing else occurs.

What can I do to fix this or to narrow down the cause?

Thanks

Confused on implementing popup with javascript

$
0
0

I'd like to understand how this works with Javascript. Basically, I have the popup working with the modal extender in my repeater, (as far as opening and closing the popup with the link in the repeater) and if I can just can the variables of the html dropdown selector and text box to the page I designated in action="alertmod.aspx", I should be able to retrieve them with the request.query method I believe. I changed the button to submit the form to a asp.net button with runat="server", but I think javascript won't require that kind of button running on client side. How do I make the modal extender do what it needs to do to get the data alertmod.aspx? Also, I need to get the TopicID from the sqldatasource and send it along with the other 2 variables. How is this done?

Here what I have currently:

<asp:Repeater ID="forumpost" runat="server" DataSourceID="SqlDataSource1" OnItemDataBound="Forumpost_Onitemdatabound"><ItemTemplate><table border="1" width="99%" align="center"><tr><td align="center"><b>Author</b></td><td><asp:HyperLink ID="HyperLink4" runat="server" NavigateUrl='<%#Eval("TopicID", "replytopost.aspx?tid={0}") %>'>Reply</asp:HyperLink><asp:HyperLink ID="Hyperlink5" CssClass="hideGridColumn" runat="server" NavigateUrl='<%#Eval("TopicID", "editpost.aspx?tid={0}") %>'>Edit</asp:HyperLink><asp:HyperLink ID="HyperLink6" runat="server" NavigateUrl='<%#Eval("Username", "viewposter.aspx?mid={0}") %>'>View Poster Profile</asp:HyperLink><asp:HyperLink ID="BtnShow" runat="server" href="">Alert Moderator</asp:HyperLink><!-- ModalPopupExtender --><cc1:ModalPopupExtender ID="mp1" runat="server" PopupControlID="Panel1" TargetControlID="btnShow"
                            CancelControlID="btnClose" BackgroundCssClass="modalBackground" ></cc1:ModalPopupExtender><asp:Panel ID="Panel1" runat="server" CssClass="modalPopup" align="center" Style="display: none"><h2>
                                Alert Moderators</h2><div id="inline"><form id="contact" name="contact" action="alertmod.aspx" method="post"><label for="alert-type">
                                    Type:</label><select id="alert-type"><option value="0">(Choose an Alert Type)</option><option value="Spam">Spam/Advertising</option></select><br /><br /><label class="reason" for="alert-reason" >
                                    Reason:</label><textarea id="alert-reason" cols="30" rows="5"></textarea></form><br /><asp:Button ID="BtnSubmit" runat="server" Text="Submit" /><div class="float-right error" style="display: none;">
                                    Please fix errors!</div></div><div class="messages" style="display: none;"></div><br /><asp:Button ID="btnClose" runat="server" Text="Close" /></asp:Panel><!-- ModalPopupExtender --></td></tr><tr><td style="vertical-align: top; text-align: center; font-size: large;" width="150px"><asp:Image ID="Avatar1" runat="server" Width="80px" Height="80px" /><br /><asp:Label ID="lbluser" runat="server" Text='<%# Container.DataItem("Username")%>'
                            Font-Size="Large"></asp:Label><br /><asp:Label ID="Lblposts" runat="server" Text="" Font-Size="Small"></asp:Label></td><td width="800px" valign="top"><asp:Literal ID="Literal1" runat="server" Mode="Transform" Text='<%# Container.DataItem("Threadtext")%>'></asp:Literal></td></tr></table></ItemTemplate></asp:Repeater>


Uncaught RangeError: Maximum call stack size exceeded error will occur in the time of sending the array data from view to controller

$
0
0

Uncaught RangeError: Maximum call stack size exceeded error will occur in the time of sending the array data from view to controller

searching for a straight refrence for learning ajax with or without jquery on mvc and webform

$
0
0

hi.

im searching for good refrence and way to learn ajax on asp. can you give me a good source to learn it completely

thank you for helping

Tab Container

$
0
0

Hi all,

  Iam using ajax tab container in this i need to enable the tab panels one by one and i want show the header of that panel if i write like this TabPanel2.Enabled = false;header will be disappearing but i want to display header in disable mode is there any other way to do  this  

Why doesn't ajax modal popup show a datacontrol that is loaded dynamically ?

$
0
0

I am using Ajax popup extender which should show gridview upon clicking a imagebutton in inside another gridview but POPUP doesn't show any datacontrol that is populated dynamically even a label. 

Why ? 

<asp:UpdatePanel ID="updMdl" runat="server" UpdateMode="Conditional"><ContentTemplate><asp:HiddenField ID="lnkFake" runat="server" /><asp:ModalPopupExtender runat="server" BackgroundCssClass="modal" ID="mdlPopUpShowHearingsData" TargetControlID="lnkfake"
PopupControlID="popUp"></asp:ModalPopupExtender><asp:Panel runat="server" ID="popUp" CssClass="modalPopup"><asp:Label runat="server" ID="lbl" ClientIDMode="Static" CssClass="label-blue" Font-Size="Larger"></asp:Label><h2>hihihiiuhhuihhuuiiuhhiu</h2><asp:GridView runat="server" ID="grdviewCaseHearingsDetails" ClientIDMode="Static" AllowPaging="true"
PageSize="15" OnPageIndexChanging="grdviewCaseHearingsDetails_PageIndexChanging"
PagerStyle-BackColor="#99CC99" HeaderStyle-BackColor="#99CC99"
DataKeyNames="pk_CaseHearings_ID" AutoGenerateColumns="false"
CssClass="table table-condensed table-bordered table-striped table-responsive scrollable" Width="110%" Style="margin: -6px 9px -5px -21px"></asp:GridView></asp:Panel></ContentTemplate></asp:UpdatePanel>



protected void grdViewCasesByCaseNo_RowCommand(object sender, GridViewCommandEventArgs e)
{

int index = Convert.ToInt32(e.CommandArgument);
int CaseID = Convert.ToInt32(grdViewCasesByCaseNo.DataKeys[index].Value);

if (e.CommandName == "cmdHearingDetails")
{

updMdl.Update();
mdlPopUpShowHearingsData.Show();
lbl.Text= "Show me something";
popUp.Visible = true; } }



tab not focus/select datepicker image

$
0
0

I have a form with multiple textboxes and datepicker. When I do tab, the cursor goes from one text box to another textbox but the datepicker image is not selected with tab.

I've to use mouse to select the datepicker. How can I solve this problem ?

<div class="form-group"><label>Date Of Birth</label><asp:TextBox ID="txtDOB" runat="server" CssClass="txt-control" /><asp:Image ID="calendarImg1" runat="server" ImageUrl="~/images/calendar_month.gif"
                                        Style="cursor: pointer" /><ajaxToolkit:CalendarExtender ID="CAL" runat="server" Format="yyyy-MM-dd" PopupButtonID="calendarImg1"
                                        TargetControlID="colDateFrom" CssClass="calender" /></div>

Viewing all 5678 articles
Browse latest View live