473,799 Members | 2,727 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.EventArg s) Handles Me.Init
If Not (Page.IsPostBac k) Then
If Not String.IsNullOr Empty(Request.Q ueryString("Rpt Type")) Then
Dim rptType As String =
Request.QuerySt ring("RptType") .ToString
Select Case rptType
Case "Invoice"
ReportTypeCombo .SelectedIndex = 0
Session("RptTyp e") = "Invoice"
Case "P.O."
ReportTypeCombo .SelectedIndex = 1
Session("RptTyp e") = "P.O."
Case "Contract"
ReportTypeCombo .SelectedIndex = 2
Session("RptTyp e") = "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 2133
Jon
Make sure that code runs AFTER you populate the combo box
"ABC" <abc.abc.com> wrote in message
news:O9******** ******@TK2MSFTN GP10.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.EventArg s) Handles Me.Init
If Not (Page.IsPostBac k) Then
If Not String.IsNullOr Empty(Request.Q ueryString("Rpt Type"))
Then
Dim rptType As String =
Request.QuerySt ring("RptType") .ToString
Select Case rptType
Case "Invoice"
ReportTypeCombo .SelectedIndex = 0
Session("RptTyp e") = "Invoice"
Case "P.O."
ReportTypeCombo .SelectedIndex = 1
Session("RptTyp e") = "P.O."
Case "Contract"
ReportTypeCombo .SelectedIndex = 2
Session("RptTyp e") = "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
10226
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 rendering of <pre> in a fixed width font. To change that I'd have to specify a proportional font family, thereby falling into the size pitfall that is associated with any sort of author specified font family: a) If I specify a sans serif font...
7
18537
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 solid; color:red;
3
12927
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 preserve formatting (white space and line feeds). However, this is not true when doing the same with the <code> tag listing (it will all be pasted on one line with multiple successive spaces treated as a single space) despite the fact that...
5
718
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 preserve formatting (white space and line feeds). However, this is not true when doing the same with the <code> tag listing (it will all be pasted on one line with multiple successive spaces treated as a single space) despite the fact that...
8
3804
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
9689
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9550
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10269
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10248
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10032
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9085
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5597
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4148
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2942
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.