crundle
asked on
How to preform updatepanel postback from javascript
Need to do a partial page post back from javascript, I have it now but the whole page post back. When I set it to UpdateMode="Conditional" everything else on the page post back not the section I need.
<div class="box-3">
Service<br />
<asp:UpdatePanel ID="UpdatePanel1" runat="server" >
<ContentTemplate>
<asp:DropDownList ID="cmbNewService" runat="server" DataTextField="Serv_Type" DataValueField="pk_CarrierID">
</asp:DropDownList>
<asp:LinkButton ID="LinkButton1" runat="server" style="display:none;" onclick="textboxchange" >
LinkButton </asp:LinkButton>
</ContentTemplate>
</asp:UpdatePanel>
</div>
below is the java being called
function raiseAsyncPostback() {
__doPostBack("<%= me.LinkButton1.UniqueID %>", "");
}
ASKER
No effect, nothing was posted back. HTML code below from rendering.
function raiseAsyncPostback() {
document.getElementById("c tl00$MainC ontent$Lin kButton1") .click();
// __doPostBack("ctl00$MainCo ntent$Link Button1", "");
}
<div id="MainContent_UpdatePane l1">
<select name="ctl00$MainContent$cm bNewServic e" id="MainContent_cmbNewServ ice">
<option value="1::1">Port\Port</op tion>
<option value="1::2">Port\Door</op tion>
</select>
<a id="MainContent_LinkButton 1" href="javascript:WebForm_D oPostBackW ithOptions (new WebForm_PostBackOptions(&q uot;ctl00$ MainConten t$LinkButt on1", "", true, "", "", false, true))" style="display:none;">
LinkButton
</a>
function raiseAsyncPostback() {
document.getElementById("c
// __doPostBack("ctl00$MainCo
}
<div id="MainContent_UpdatePane
<select name="ctl00$MainContent$cm
<option value="1::1">Port\Port</op
<option value="1::2">Port\Door</op
</select>
<a id="MainContent_LinkButton
LinkButton
</a>
Are your using the VS2010 and asp.Net 4.0 for the development,
then add the below attribute ClientIDMode="Inherit" to the control and check
<asp:LinkButton ID="LinkButton1" runat="server" style="display:none;" onclick="textboxchange" ClientIDMode="Inherit" >
LinkButton </asp:LinkButton>
then add the below attribute ClientIDMode="Inherit" to the control and check
<asp:LinkButton ID="LinkButton1" runat="server" style="display:none;" onclick="textboxchange" ClientIDMode="Inherit" >
LinkButton </asp:LinkButton>
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
tried both and didn't fire. I'll setup a demo page to see if something else is causing the problem.
I have identified the issue in the control declaration
style="visibility:hidden;"
<asp:LinkButton ID="LinkButton1" runat="server" style="visibility:hidden;" onclick="textboxchange" ClientIDMode="AutoID" >
LinkButton </asp:LinkButton>
change the option display to visibility.
Check this for the clarification as why the event is not get fired for "dispaly:none"
http://webdesign.about.com/od/css/f/blfaqhidden.htm
style="visibility:hidden;"
<asp:LinkButton ID="LinkButton1" runat="server" style="visibility:hidden;"
LinkButton </asp:LinkButton>
change the option display to visibility.
Check this for the clarification as why the event is not get fired for "dispaly:none"
http://webdesign.about.com/od/css/f/blfaqhidden.htm
function raiseAsyncPostback() {
document.getElementById("<
}