groovbox303
asked on
__doPostBack Not Working
Hi Experts,
I have a problem Im hoping someone here can help me out here with. I am trying to use an imageButton to call the click event of a link button by doing a forced postback. This should be a simple task, but I have had no luck with this, and am stuck. The code for both the aspx file including the javascript function and the codebehind for the LinkButton_Click event is also posted. Any help to solve this would be appreciated. Thanks in Advance
I have a problem Im hoping someone here can help me out here with. I am trying to use an imageButton to call the click event of a link button by doing a forced postback. This should be a simple task, but I have had no luck with this, and am stuck. The code for both the aspx file including the javascript function and the codebehind for the LinkButton_Click event is also posted. Any help to solve this would be appreciated. Thanks in Advance
ASPX
<script type="text/javascript">
function FillText()
{
//debugger;
__doPostBack('<%= LinkButton1.UniqueID %>', '');
//__doPostBack("LinkButton1","");
}
</script>
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<asp:UpdatePanel ID="UpdatePanel1" runat="server" ChildrenAsTriggers="False" UpdateMode="Conditional">
<Triggers>
<asp:AsyncPostBackTrigger ControlID="LinkButton1" EventName="Click" />
</Triggers>
<ContentTemplate>
<asp:LinkButton ID="LinkButton1" runat="server" OnClick="LinkButton1_Click" CausesValidation="false">LinkButton</asp:LinkButton>
<asp:TextBox ID="TextBox1" runat="server" AutoPostBack="true"></asp:TextBox>
<br />
<br />
<div onclick='FillText()'>
<asp:ImageButton ID="ImageButton1" runat="server" />
</div>
</ContentTemplate>
</asp:UpdatePanel>
C#
protected void LinkButton1_Click(object sender, EventArgs e)
{
TextBox1.Text = "Hello There";
UpdatePanel1.Update();
}
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.