How to response from client

Discussion in 'ASP .Net Web Controls' started by Mei leng Leong, Aug 25, 2004.

  1. HI kindly helper,

    i'm facing a problem with javascript rendering from code-behind. i'm
    prompt a confirmation message to client. Would like to get response from
    client. then will proceed further action depend on the response on the
    client.

    my coding is


    <script language=javascript>
    function __doPostBack(eventTarget, eventArgument)
    {
    var theform = document.Form1;
    theform.__EVENTTARGET.value = eventTarget;
    theform.__EVENTARGUMENT.value = eventArgument;
    theform.submit();
    }
    </script>
    </HEAD>
    <body MS_POSITIONING="GridLayout">
    <form id="Form1" method="post" runat="server">
    <!-- Add two hidden variables used in __doPostBack-->
    <input type="hidden" name="__EVENTTARGET">
    <input type="hidden" name="__EVENTARGUMENT">
    <asp:TextBox ID="txt1" Runat="server"></asp:TextBox>
    <asp:Button ID="btnsubmit" Runat="server" text="submit"></asp:Button>
    <asp:Button ID="hiddenbtn" Runat="server" Visible="False"></asp:Button>
    </form>
    ========================================>
    Code behind


    Private Sub btnsubmit_Click(ByVal sender As Object, ByVal e As
    System.EventArgs) Handles btnsubmit.Click
    Dim errmsg As String
    errmsg = "<script language=javascript>" & Chr(13)
    errmsg += "if (confirm(""record exist. To Continue!""))" & Chr(13)
    errmsg += " __doPostBack('hiddenbtn','');" & Chr(13)
    ' errmsg += Chr(13)
    ' errmsg += " function fndoPostBack2(eventTarget, eventArgument) " &
    Chr(13)
    ' errmsg += "{" & Chr(13)
    'errmsg += " var theform = document.Form1;" & Chr(13)
    'errmsg += " theform.__EVENTTARGET.value = eventTarget;" & Chr(13)
    'errmsg += " theform.__EVENTARGUMENT.value = eventArgument;" & Chr(13)
    'errmsg += " theform.submit();" & Chr(13)
    errmsg += " }" & Chr(13)
    errmsg += "</script>"
    Response.Write(errmsg)
    End Sub
    ===========================>
    My question:
    1.when i render the javascript function fndopostback2 together will give
    me __EVENTARGUMENT is null

    2.if i only render the javascript confirm the __doPostback error
    message is object expected form javascript.

    is anybody have idea to solve this or any suggestion to do this. thank
    you very much.

    *** Sent via Developersdex http://www.developersdex.com ***
    Don't just participate in USENET...get rewarded for it!
     
    Mei leng Leong, Aug 25, 2004
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Charles A. Lackman
    Replies:
    2
    Views:
    8,099
    Charles A. Lackman
    Jan 11, 2006
  2. Matthew Wieder

    Response.Write and Response.Redirect

    Matthew Wieder, Jul 17, 2003, in forum: ASP .Net
    Replies:
    4
    Views:
    761
    Kevin Spencer
    Jul 17, 2003
  3. Promenade

    Response.Expires and Response.Cache

    Promenade, Dec 5, 2003, in forum: ASP .Net
    Replies:
    2
    Views:
    30,880
    Promenade
    Dec 5, 2003
  4. Sehboo
    Replies:
    3
    Views:
    8,941
    Sehboo
    Dec 10, 2003
  5. Calvin Lai
    Replies:
    6
    Views:
    21,036
    Joerg Jooss
    Dec 31, 2003
Loading...

Share This Page