I have a great Issue here ! I have a grid View which have autogenerated true.I Load another grid view in its perticular row click. I write a javascript method and here I click a button manually like docement.getElementByid("btnId").Click(),and I load the
second grid view inside this method of button click.The Whole contents are inside a Update panel.I call the java script inside the row databound of first grid . So when I run the code first time it works properly but after when I click 2nd row data are not
load properly inside the 2nd grid view as it is in the update panel. I call the javascript inside row databound . The java script Like this.
function rowClick(SubObjectId, rowindex) {
if (document.getElementById("<%=hdnSubObjectId.ClientID %>"))
document.getElementById("<%=hdnSubObjectId.ClientID %>").value = SubObjectId;
if (document.getElementById("<%=hdnRowIndex.ClientID %>"))
document.getElementById("<%=hdnRowIndex.ClientID %>").value = rowindex;
if (document.getElementById("<%=btnSubobjectsId.ClientID %>")) {
I agree with geniusvishal's opinion. There are some conflicts between ASP.NET AJAX UpdatePanels and jQuery functions.
In order to resolve it, you can use the PageRequestManager and add an End Request event handler. For details, please follow the first link geniusvishal provide to resolve it.
Best wishes,
Please mark the replies as answers if they help or unmark if not.
Feedback to us
ajaya_rout
Member
156 Points
47 Posts
Javascript not Working in Update Panel
Dec 08, 2012 05:46 AM|LINK
Hello Every One.
I have a great Issue here ! I have a grid View which have autogenerated true.I Load another grid view in its perticular row click. I write a javascript method and here I click a button manually like docement.getElementByid("btnId").Click(),and I load the second grid view inside this method of button click.The Whole contents are inside a Update panel.I call the java script inside the row databound of first grid . So when I run the code first time it works properly but after when I click 2nd row data are not load properly inside the 2nd grid view as it is in the update panel. I call the javascript inside row databound . The java script Like this.
function rowClick(SubObjectId, rowindex) {
if (document.getElementById("<%=hdnSubObjectId.ClientID %>"))
document.getElementById("<%=hdnSubObjectId.ClientID %>").value = SubObjectId;
if (document.getElementById("<%=hdnRowIndex.ClientID %>"))
document.getElementById("<%=hdnRowIndex.ClientID %>").value = rowindex;
if (document.getElementById("<%=btnSubobjectsId.ClientID %>")) {
document.getElementById("<%=btnSubobjectsId.ClientID %>").click();
}
// document.getElementById("<%=btnSubobjectsId.ClientID %>").click() = null;
//ChangeRowColor(rowindex);
return false;
}
It is not working after first Time load the page. I have never seen this issue later.Can Anyone help me.
Its Urgent.
manjuby
Participant
1131 Points
251 Posts
Re: Javascript not Working in Update Panel
Dec 08, 2012 07:25 AM|LINK
Include this within update panel,
<Triggers>
<asp:PostBackTrigger ControlID="Gridview1" />
</Triggers>
OR
Try using Asynchronous Trigger,
geniusvishal
Star
14076 Points
2794 Posts
Re: Javascript not Working in Update Panel
Dec 08, 2012 07:42 AM|LINK
Have a look over here:
http://weblogs.asp.net/hajan/archive/2010/10/07/make-them-to-love-each-other-asp-net-ajax-updatepanels-amp-javascript-jquery-functions.aspx
and here:
http://www.stormconsultancy.co.uk/blog/development/code-snippets/execute-javascript-when-an-updatepanel-is-updated/
My Website
www.dotnetvishal.com
Catherine Sh...
All-Star
23372 Points
2490 Posts
Microsoft
Re: Javascript not Working in Update Panel
Dec 10, 2012 07:11 AM|LINK
Hi,
I agree with geniusvishal's opinion. There are some conflicts between ASP.NET AJAX UpdatePanels and jQuery functions.
In order to resolve it, you can use the PageRequestManager and add an End Request event handler. For details, please follow the first link geniusvishal provide to resolve it.
Best wishes,
Feedback to us
Develop and promote your apps in Windows Store
raghavendra ...
Participant
1890 Points
435 Posts
Re: Javascript not Working in Update Panel
Dec 13, 2012 10:28 AM|LINK
Place you JS function with in update panel