Querying an ID from a hyperlink is very simple:
- First insert a parameter to the HTML hyperlink
- In the “code behind” set the redirect URL to the path of your choice
- Concatenate the path with a parameter
Example: Concatenated link with a parameter =>
Response.redirect ("index.aspx?ID=2f9")
|
Embedding a parameter in the “redirect link” will help you save time and resources.
In other words, you don’t need to create another page. You just need to insert a
parameter that will redirect the user to the same page, and then display a confirmation
message, Below is the html part of the code. |
<asp:label id="Nametxt"
Runat="server">Email:</asp:label>
<asp:TextBox id="TextBox1"
runat="server"></asp:TextBox>
<asp:label id="sourcetxt"
Runat="server">Subject:</asp:label>
<asp:TextBox id="ddltxt"
runat="server"></asp:TextBox>
<asp:label id="feedlbl"
Runat="server">Request Message:</asp:label>
<asp:TextBox id="feedbacktxt"
Runat="server" CssClass="boxtxt"
TextMode="MultiLine"></asp:TextBox>
<asp:Button id="submit"
Runat="server" Text="Submit"></asp:Button>
|
|
Now, in the code behind, we need to create a submit function that will be fired once the
user clicks submit. Here is the code for the submit function
|
Private
Sub submit_Click(ByVal
sender As System.Object,
ByVal e As System.EventArgs)
Handles submit.Click
Response.Redirect("ContactUs.aspx?message=sent")
End
Sub
|
|
You need one more piece of code, query the ID so that you can display
the confirmation message to the user. Here is the code for that.
|
|
Private Sub
Page_Load(ByVal sender As
System.Object,     ByVal e As
System.EventArgs) Handles
MyBase.Load
'Put user code to initialize the page here
If Page.IsPostBack =
False Then
If Request.QueryString("message") =
"sent" Then
validatetxt.Text = "Message sent! Thank You"
End If
End If
End Sub
|
|
|
|