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>
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