473,406 Members | 2,378 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

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

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?
Nov 19 '05 #1
2 2110
Jon
Make sure that code runs AFTER you populate the combo box
"ABC" <abc.abc.com> wrote in message
news:O9**************@TK2MSFTNGP10.phx.gbl...
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?

Nov 19 '05 #2
Hi,
Chech the same code by moving that code block from Page_Init to
Page_Load....
Praveen P.

Nov 19 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

21
by: Headless | last post by:
I've marked up song lyrics with the <pre> tag because it seems the most appropriate type of markup for the type of data. This results in inefficient use of horizontal space due to UA's default...
7
by: Alan Illeman | last post by:
How do I set several different properties for PRE in a CSS stylesheet, rather than resorting to this: <BODY> <PRE STYLE="font-family:monospace; font-size:0.95em; width:40%; border:red 2px...
3
by: Michael Shell | last post by:
Greetings, Consider the XHTML document attached at the end of this post. When viewed under Firefox 1.0.5 on Linux, highlighting and pasting (into a text editor) the <pre> tag listing will...
5
by: Michael Shell | last post by:
Greetings, Consider the XHTML document attached at the end of this post. When viewed under Firefox 1.0.5 on Linux, highlighting and pasting (into a text editor) the <pre> tag listing will...
8
by: Jarno Suni not | last post by:
It seems to be invalid in HTML 4.01, but valid in XHTML 1.0. Why is there the difference? Can that pose a problem when such a XHTML document is served as text/html?
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.