Click here to Skip to main content
15,879,326 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I have a dashboard grid having the below code.

<asp:GridView ID="GrdList" runat="server" AutoGenerateColumns="True" ShowHeaderWhenEmpty="True"   Width="100%" CssClass="GridControl" GridLines="Vertical">

<Columns>                 
</Columns>

<EmptyDataTemplate>
 <%=ABS.Helper.ResxMessage("NoDataexists") %> 
</EmptyDataTemplate>
                                
<HeaderStyle CssClass="grid-viewHeader" ForeColor="White" />
<RowStyle CssClass="Rowstyle" />
<FooterStyle CssClass="grid-viewFooterStyle" />
<SelectedRowStyle CssClass="grid-viewSelectedRowStyle" />
<EmptyDataRowStyle CssClass="grid-viewEmptyDataRowStyle" />
<SortedAscendingCellStyle BackColor="#F1F1F1" />
<SortedAscendingHeaderStyle BackColor="#808080" />
 <SortedDescendingCellStyle BackColor="#CAC9C9" />
<SortedDescendingHeaderStyle BackColor="#383838" />

 </asp:GridView>


What I have tried:

I am binding the data to this dash board using back end code as follows

if (!String.IsNullOrEmpty(Request.QueryString["id"]))
              {

                  DataTable dt = new DataTable();
                  // Query string value is there so now use it
                  int thePID;
                  thePID = Convert.ToInt32(Request.QueryString["id"]);
                  if (thePID == 1)
                  {
                      dt = APQoutation();
                      GrdList.DataSource = dt;
                      GrdList.DataBind();

                  }
                  else if (thePID == 2)
                  {
                      dt = APPO();
                      GrdList.DataSource = dt;
                      GrdList.DataBind();
                  }
                  else if (thePID == 3)
                  {
                      dt = APDO();
                      GrdList.DataSource = dt;
                      GrdList.DataBind();
                  }
                  else if (thePID == 4)
                  {
                      dt = APIV();
                      GrdList.DataSource = dt;
                      GrdList.DataBind();
                  }
                  else if (thePID == 5)
                  {
                      dt = APPV();
                      GrdList.DataSource = dt;
                      GrdList.DataBind();
                  }
                  else if (thePID == 6)
                  {
                      dt = ARGQ();
                      GrdList.DataSource = dt;
                      GrdList.DataBind();
                  }
                  else if (thePID == 7)
                  {
                      dt = ARPO();
                      GrdList.DataSource = dt;
                      GrdList.DataBind();
                  }

                  else if (thePID == 8)
                  {
                      dt = ARDO();
                      GrdList.DataSource = dt;
                      GrdList.DataBind();
                  }
                  else if (thePID == 9)
                  {
                      dt = ARIV();
                      GrdList.DataSource = dt;
                      GrdList.DataBind();
                  }
                  else if (thePID == 10)
                  {
                      dt = ARRC();
                      GrdList.DataSource = dt;
                      GrdList.DataBind();
                  }
              }


          }
      }


By using request query string i am sending the id from another page so that the code can identify and select the data for binding to the grid.

As there are 10 tables those are binding dynamically to the same grid, How can i change the header text of the grid by using the text resources for each selection of request query string.
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900