Submitting forms second time just resets page

Discussion in 'ASP .Net Datagrid Control' started by Steven Reid, Dec 29, 2004.

  1. Steven Reid

    Steven Reid Guest

    Hi All,

    I am trying to create a little form where I can enter a SQL query and
    return the data in a datagrid. A lot of the times the first time I
    open the page and enter a query the datagrid returns data and is fine.
    But when I try to resubmit the query or enter another query, the form
    just resets and nothing is returned and the form is cleared. I can
    use the back button and the sql query statement reappears in the form
    but I cant get the form to submit consistantly!


    Here is the code to the form

    <%@ Page language="c#" Codebehind="RunSQL.aspx.cs"
    AutoEventWireup="false" Inherits="Docs.Manager.RunSQL" %>
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
    <HTML>
    <HEAD>
    <title>RunSQL</title>
    <meta name="GENERATOR" Content="Microsoft Visual Studio 7.0">
    <meta name="CODE_LANGUAGE" Content="C#">
    <meta name=vs_defaultClientScript content="JavaScript">
    <meta name=vs_targetSchema
    content="http://schemas.microsoft.com/intellisense/ie5">
    </HEAD>
    <body MS_POSITIONING="GridLayout">
    <form id="RunSQL" method="post" runat="server">
    <a href="runsql.aspx">RESET</a><br>
    <asp:Label ID="lMessage" Runat=server>Before Run
    Script</asp:Label><br>
    <asp:TextBox id=TextBox1 runat="server" Width="354px"
    Height="207px" TextMode="MultiLine"></asp:TextBox><br>
    <asp:Button id=Button1 runat="server" Width="353px" Height="28px"
    Text="Run"></asp:Button><br>
    <asp:DataGrid id=DataGrid1 runat="server" Width="352px"
    Height="163px"></asp:DataGrid><br>

    </form>

    </body>
    </HTML>



    Thanks

    Steven Reid
    Steven Reid, Dec 29, 2004
    #1
    1. Advertising

  2. When you say that the form is cleared, do you mean the controls dissapear? or
    that the datagrid is empty?
    R. Thomas

    "Steven Reid" wrote:

    > Hi All,
    >
    > I am trying to create a little form where I can enter a SQL query and
    > return the data in a datagrid. A lot of the times the first time I
    > open the page and enter a query the datagrid returns data and is fine.
    > But when I try to resubmit the query or enter another query, the form
    > just resets and nothing is returned and the form is cleared. I can
    > use the back button and the sql query statement reappears in the form
    > but I cant get the form to submit consistantly!
    >
    >
    > Here is the code to the form
    >
    > <%@ Page language="c#" Codebehind="RunSQL.aspx.cs"
    > AutoEventWireup="false" Inherits="Docs.Manager.RunSQL" %>
    > <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
    > <HTML>
    > <HEAD>
    > <title>RunSQL</title>
    > <meta name="GENERATOR" Content="Microsoft Visual Studio 7.0">
    > <meta name="CODE_LANGUAGE" Content="C#">
    > <meta name=vs_defaultClientScript content="JavaScript">
    > <meta name=vs_targetSchema
    > content="http://schemas.microsoft.com/intellisense/ie5">
    > </HEAD>
    > <body MS_POSITIONING="GridLayout">
    > <form id="RunSQL" method="post" runat="server">
    > <a href="runsql.aspx">RESET</a><br>
    > <asp:Label ID="lMessage" Runat=server>Before Run
    > Script</asp:Label><br>
    > <asp:TextBox id=TextBox1 runat="server" Width="354px"
    > Height="207px" TextMode="MultiLine"></asp:TextBox><br>
    > <asp:Button id=Button1 runat="server" Width="353px" Height="28px"
    > Text="Run"></asp:Button><br>
    > <asp:DataGrid id=DataGrid1 runat="server" Width="352px"
    > Height="163px"></asp:DataGrid><br>
    >
    > </form>
    >
    > </body>
    > </HTML>
    >
    >
    >
    > Thanks
    >
    > Steven Reid
    >
    R. Thomas, aka Xtreme.Net, Dec 29, 2004
    #2
    1. Advertising

  3. Steven Reid

    Steve Reid Guest

    Hi,

    There is currently a text box (where you can enter the sql statement)
    and a submit button on the page.

    The expected action is that when you type in a SQL statement and click
    submit, the results appear in the datagrid below. If you enter another
    SQL Query then the new results appear in the datagrid below.

    What is currently happening is that 'sometimes' on the first time on the
    page, the above happens.....
    but often all that happens when I click the submit button is that the
    progesss bar on the status line appears starts moving, then the text box
    gets cleared, and no data appears in the datagrid area.

    If I DO manage to get the datagrid to appear... if I try to submit a
    second query, then the text area gets cleared and no data appears.

    Thanks

    Steve


    *** Sent via Developersdex http://www.developersdex.com ***
    Don't just participate in USENET...get rewarded for it!
    Steve Reid, Dec 30, 2004
    #3
  4. Cant say much like this.. you have to debug and see whats happening...
    However few pointers :
    Check if the binding takes place EVERY time
    Check if the data is retrieved from the db EVERY time
    Hth...
    R. Thomas

    "Steve Reid" wrote:

    >
    >
    > Hi,
    >
    > There is currently a text box (where you can enter the sql statement)
    > and a submit button on the page.
    >
    > The expected action is that when you type in a SQL statement and click
    > submit, the results appear in the datagrid below. If you enter another
    > SQL Query then the new results appear in the datagrid below.
    >
    > What is currently happening is that 'sometimes' on the first time on the
    > page, the above happens.....
    > but often all that happens when I click the submit button is that the
    > progesss bar on the status line appears starts moving, then the text box
    > gets cleared, and no data appears in the datagrid area.
    >
    > If I DO manage to get the datagrid to appear... if I try to submit a
    > second query, then the text area gets cleared and no data appears.
    >
    > Thanks
    >
    > Steve
    >
    >
    > *** Sent via Developersdex http://www.developersdex.com ***
    > Don't just participate in USENET...get rewarded for it!
    >
    R. Thomas, aka Xtreme.Net, Dec 30, 2004
    #4
  5. Steven Reid

    Guest

    Hi there,

    What is the best way to check this?

    Steve
    , Jan 4, 2005
    #5
  6. Steven Reid

    Guest

    Hi there,

    What is the best way to check this?

    Steve
    , Jan 4, 2005
    #6
  7. If you just step thru it while debugging, you'll know all the previous
    mentioned info. Then you'll know where is the problem occuring..
    Hth...
    R. Thomas

    "" wrote:

    > Hi there,
    >
    > What is the best way to check this?
    >
    > Steve
    >
    >
    R. Thomas, aka Xtreme.Net, Jan 4, 2005
    #7
  8. Hey if try wrapping you on page load event with these two lines of code.


    If Not IsPostBack Then

    End if

    The "not ispostback" determine if the page is being opened for the first time or if it is being re-submitted.

    Give it a try

    Posted via DevelopmentNow Group
    www.developmentnow.com/
    www.developmentnow.com
    Steve Kirchner, Feb 2, 2005
    #8
    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. Bjorn

    submitting two forms in same page?

    Bjorn, Jul 28, 2004, in forum: ASP General
    Replies:
    3
    Views:
    140
    Bjorn
    Jul 29, 2004
  2. Brian Takita
    Replies:
    2
    Views:
    122
    Brian Takita
    Jul 25, 2005
  3. belzibob

    Submitting multiple forms on one page

    belzibob, Aug 19, 2003, in forum: Javascript
    Replies:
    1
    Views:
    129
    Fred Basset
    Aug 27, 2003
  4. yelipolok
    Replies:
    4
    Views:
    239
    John W. Krahn
    Jan 27, 2010
  5. Joris Gillis
    Replies:
    0
    Views:
    184
    Joris Gillis
    Apr 18, 2005
Loading...

Share This Page