Page.IsPostBack Gets a value indicating whether the page is being loaded in response to a client postback, or if it is being loaded and accessed for the first time. so to have value of drop down on every selection you have to check whether its PostBack or
Not..
in c#.net you can do like
privatevoid Page_Load()
{ if (!IsPostBack)
{ // have drop down value // to appear before the first roundtrip.
Validate();
}
}
in VB.net you can do like
<div class=libCScode id=ctl00_rs1_mainContentContainer_ctl34_VisualBasic> <div class=CodeSnippetTitleBar> <div class=CopyCodeButton>Sub Page_Load IfNot IsPostBack ' Validate initially to force the asterisks ' to appear before the first roundtrip.
Validate() EndIf EndSub
</div> <div class=CopyCodeButton> </div> <div class=CopyCodeButton>hope this wud work..</div></div></div>
Declare a list item and add it to the dropdown constructively. You can use insert option of dropdown list to insert at a particular index. This becomes useful when we are binding the dropdown from database and u need a default item in dropdown
manganno
Member
2 Points
1 Post
Re: Why am I not able to get the value or text of the SelectedItem in my DropDownList on PostBack...
Feb 27, 2008 03:09 AM|LINK
hi guys...i'm very new in VB.NET..really needs help...what's wrong with my coding below?pls help me...
If Not Page.IsPostBack Thencboorifice.DataSource = "wtestgasfmaintab" -----------> table name
cboorifice.DataTextField = "WTESTSPORIFICESZ" -----------> field name
cboorifice.DataValueField = "WTESTSPORIFICESZ" -----------> field name
cboorifice.DataBind()
End If
sri2705
Member
9 Points
5 Posts
Re: Why am I not able to get the value or text of the SelectedItem in my DropDownList on PostBack...
Jun 06, 2008 06:39 AM|LINK
hi
set postback=true in dropdownlist properties
CreativeMind
Member
91 Points
47 Posts
Re: Why am I not able to get the value or text of the SelectedItem in my DropDownList on PostBack...
Jun 12, 2008 11:58 AM|LINK
themasterpie...
Member
4 Points
4 Posts
Re: Why am I not able to get the value or text of the SelectedItem in my DropDownList on PostBack...
Jun 16, 2008 08:01 AM|LINK
hii..
Page.IsPostBack Gets a value indicating whether the page is being loaded in response to a client postback, or if it is being loaded and accessed for the first time. so to have value of drop down on every selection you have to check whether its PostBack or Not..
in c#.net you can do like
private void Page_Load()
{
if (!IsPostBack)
{
// have drop down value
// to appear before the first roundtrip.
Validate();
}
}
in VB.net you can do like
<div class=libCScode id=ctl00_rs1_mainContentContainer_ctl34_VisualBasic> <div class=CodeSnippetTitleBar> <div class=CopyCodeButton>Sub Page_LoadIf Not IsPostBack
' Validate initially to force the asterisks
' to appear before the first roundtrip.
Validate()
End If
End Sub
</div> <div class=CopyCodeButton> </div> <div class=CopyCodeButton>hope this wud work..</div></div></div>
Web Developer
CoCubes.com
nideeshm
Participant
1069 Points
269 Posts
Re: Why am I not able to get the value or text of the SelectedItem in my DropDownList on PostBack...
Jul 16, 2008 12:30 PM|LINK
Declare a list item and add it to the dropdown constructively. You can use insert option of dropdown list to insert at a particular index. This becomes useful when we are binding the dropdown from database and u need a default item in dropdown
Nideesh.S
Mark as answer, If it helps you.