Link to home
Start Free TrialLog in
Avatar of groovbox303
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


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();
    }

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of David H.H.Lee
David H.H.Lee
Flag of Malaysia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial