How to pre-set combo textbox's selectedindex value from querystring passed from another page?

A

ABC

How to pre-set combo textbox's selectedindex value from querystring passed
from another page?

I pass the querystring to set combo text box (change selectedindex on
Page_Init).
Source code as:

Protected Sub Page_Init(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Me.Init
If Not (Page.IsPostBack) Then
If Not String.IsNullOrEmpty(Request.QueryString("RptType")) Then
Dim rptType As String =
Request.QueryString("RptType").ToString
Select Case rptType
Case "Invoice"
ReportTypeCombo.SelectedIndex = 0
Session("RptType") = "Invoice"
Case "P.O."
ReportTypeCombo.SelectedIndex = 1
Session("RptType") = "P.O."
Case "Contract"
ReportTypeCombo.SelectedIndex = 2
Session("RptType") = "Contract"
End Select
End If
End If
End Sub

When I run it, it don't work. What is my wrong?
 
P

Praveen

Hi,
Chech the same code by moving that code block from Page_Init to
Page_Load....
Praveen P.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top