문제

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.

도움이 되었습니까?

해결책

In Page_Load:

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

You should be able to take it from there?

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top