Note that there are some explanatory texts on larger screens.

plurals
  1. POGridview disappears when page is refreshed
    primarykey
    data
    text
    <p>I have a gridview that is being populated from a sql database. When the results are displayed I am linking the district #'s to a new contact page for each one. Ex. d1.aspx, d2.aspx, d3.aspx etc. On each of those pages there is a link to return back to the orginal page. When this happens the original page is refrreshed and the previous gridview results are gone. Is it possible to stop this from happening or is there a better way to do something like this? </p> <p></p> <pre><code>&lt;Columns&gt; &lt;asp:BoundField HeaderText="Name" DataField="school" /&gt;&lt;asp:BoundField /&gt; &lt;asp:TemplateField HeaderText="District" HeaderStyle-HorizontalAlign="Left"&gt; &lt;ItemTemplate&gt; &lt;asp:HyperLink ID="HyperLink1" runat="server" NavigateUrl='&lt;%# Eval("district", "cdms/d{0}.aspx") %&gt;' Text='&lt;%# Eval("district") %&gt;'&gt; &lt;/asp:HyperLink&gt; &lt;/ItemTemplate&gt; &lt;/asp:TemplateField&gt; &lt;/Columns&gt; &lt;EmptyDataTemplate&gt; &lt;span style="color: rgb(255, 0, 0);"&gt;No records found!&lt;/span&gt; &lt;/EmptyDataTemplate&gt; &lt;/asp:GridView&gt; </code></pre> <p>Codebehind:</p> <pre><code>protected void btnSubmit_Click(object sender, EventArgs e) { BuildGridView1(); GridView1.DataBind(); GridView1.Visible = true; } private void BuildGridView1() { GridView1.DataSource = new Select(District.Schema.TableName + ".*") .From(District.Schema) .Where(District.Columns.Zip).IsEqualTo(this.txtZip.Text) .OrderAsc(District.Columns.Zip) .ExecuteDataSet(); } protected void GridView1_PageIndexChanging(object sender, GridViewPageEventArgs e) { BuildGridView1(); GridView1.PageIndex = e.NewPageIndex; GridView1.DataBind(); } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload