Question

I am using the QueryStringParameter to pass a parameter in the SELECT statement to display only the necessary data on the page from SQL Server.

<SelectParameters>
    <asp:QueryStringParameter Name="doc_family" QueryStringField="doc_family" Type="String" />
</SelectParameters>

I was wondering what if I could take advantage of the QueryStringParameter and write some IF statements to add custom headings as per data fetched on the page instead of one generic one. As an example:

  1. If (doc_family = CR) then display "Clean Room" on the page
  2. If (doc_family = QA) then display "Quality Assurance" on the page
  3. If (doc_family = TP) then display "Test Protocol" on the page
  4. Else "Page name is not available"

Here is the code snipped for the ASP label control wrapped in H1 tag:

<h1 style="color:Black;">
    <asp:Label ID="DocumentNameLabel" runat="server" Text="Hello World" />
</h1>

My project is written in C# and the QueryStringParameter is used in this format in the URL ~/ProceduresForms.aspx?doc_family=CR.

Any help is appreciate.

Was it helpful?

Solution

In Page_Load:

if(Request.QueryString["doc_family"] == "CR") DocumentNameLabel.Text = "CleanRoom";

You should be able to take it from there?

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top