ASPForums.Net RSS Feedhttp://www.aspforums.net/Handlers/RSS.ashxLatest additions to the content that appears on ASPForums.Net(c) 2019 www.aspforums.com. All rights reserved.Redirect to new page on ASP.Net DropDownList selection using C# and VB.Net<p>Hey <a class="username" rel="micah"> micah</a>,</p> <p>Please refer below sample.</p> <p><span style="text-decoration: underline;"><strong>HTML</strong></span></p> <p><strong>CS.aspx</strong></p> <pre class="brush: html">&lt;div&gt; Select Fruites Name : &lt;asp:DropDownList runat=&#34;server&#34; ID=&#34;ddlFruites&#34; AutoPostBack=&#34;true&#34; OnTextChanged=&#34;Redirect&#34;&gt; &lt;asp:ListItem Text=&#34;Select&#34; /&gt; &lt;asp:ListItem Text=&#34;Orange&#34; /&gt; &lt;asp:ListItem Text=&#34;Mango&#34; /&gt; &lt;asp:ListItem Text=&#34;Grapes&#34; /&gt; &lt;asp:ListItem Text=&#34;Banana&#34; /&gt; &lt;/asp:DropDownList&gt; &lt;/div&gt;</pre> <p><strong>MessageCS.aspx</strong></p> <pre class="brush: html">&lt;div&gt; &lt;asp:Label ID=&#34;lblMessage&#34; runat=&#34;server&#34; /&gt; &lt;/div&gt;</pre> <p><span style="text-decoration: underline;"><strong>Code</strong></span></p> <p><strong>CS</strong></p> <p><strong>CS.aspx.cs</strong></p> <pre class="brush: csharp">protected void Redirect(object sender, EventArgs e) { if (!string.IsNullOrEmpty(ddlFruites.SelectedItem.Text)) { Response.Redirect(&#34;MessageCS.aspx?value=&#34; + ddlFruites.SelectedItem.Text); } }</pre> <p><strong>MessageCS.aspx.cs</strong></p> <pre class="brush: csharp">protected void Page_Load(object sender, EventArgs e) { string value = Request.QueryString[&#34;value&#34;]; lblMessage.Text = &#34;Select value is : &lt;b&gt;&#34; + value + &#34;&lt;/b&gt;&#34;; }</pre> <p><strong>VB.Net</strong></p> <p><strong>VB.aspx.vb</strong></p> <p>&nbsp;</p> <pre class="brush: vb">Protected Sub Redirect(ByVal sender As Object, ByVal e As EventArgs) If Not String.IsNullOrEmpty(ddlFruites.SelectedItem.Text) Then Response.Redirect(&#34;MessageVB.aspx?value=&#34; &amp; ddlFruites.SelectedItem.Text) End If End Sub</pre> <p><strong>MessageVB.aspx.vb</strong></p> <pre class="brush: vb">Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs) Handles Me.Load Dim value As String = Request.QueryString(&#34;value&#34;) lblMessage.Text = &#34;Select value is : &lt;b&gt;&#34; &amp; value &amp; &#34;&lt;/b&gt;&#34; End Sub</pre> <p>&nbsp;</p>https://www.aspforums.net:443/Threads/277031/Redirect-to-new-page-on-ASPNet-DropDownList-selection-using-C-and-VBNet/https://www.aspforums.net:443/Threads/277031/Redirect-to-new-page-on-ASPNet-DropDownList-selection-using-C-and-VBNet/Thu, 13 Dec 2018 02:22:26 GMT