PC Review


Reply
Thread Tools Rate Thread

dropdownlist..urgent help

 
 
=?Utf-8?B?SXNhYmVs?=
Guest
Posts: n/a
 
      5th Apr 2006
I have a dropdownlist ,for which i think the selectindexchnaged event is not
getting fired. Please help.
Thanks,

Here is the code:

public class class1: Systems.Web.UI.Page
{
//all the declarations
public void GetItems()
{
// GetConnection is a function that gets connection string and opens
the
//connection
SqlConnection myConn = GetConnection();
DataSet dsTemp;
dsTemp = new DataSet();
string strSQl ="Select name from Company";
SqlDataAdapter myAda = new SQlAdapter(strSQL,myConn);
myAda.Fill(dsTemp,"temptab");
DDLName.DataSource = dsTemp.Tables["temptab"];
DDLName.DataTextField = dsTemp.Tables["temptab"].Columns[0].ToString();
DDLName.DataValueField = dsTemp.Tables["temptab"].Columns[0].ToString();
DDLName.DataBind();
myConn.Close();
}
public void DDLName_SelectedIndexChanged(object sernder,EventArgs e)
{
lblLabel2.Text = "Event Fired" + DDLName.SelectItem.Text;
/// Do some things here like set another DDL List according to
selectedItem
}
private void Page_Load(object sender,EventArgs e)
{
DDLName.AutoPostBack = true;
DDLName.EnableViewState = false;
if(!Postback)
{
GetItems();
}
}
protected override void OnInit(EventArgs e)
{
DDLName.SelectedIndexChanged += new
EventHandler(DDLName_SelectedIndexChanged);
}
}
 
Reply With Quote
 
 
 
 
Rajesh
Guest
Posts: n/a
 
      22nd May 2006
Hi Isabel,

It happens sometimes even though you had declared the delegate event of the
control's SelectedIndexChanged it doesn't fire at runtime.Try these options

1.Create a new webpage,test this control on that web page

2.Or use the click event of the control in the same page (instead of the the
new web page, option 1.)

Raj

"Isabel" <(E-Mail Removed)> wrote in message
news:F3DC990F-401B-4B79-9942-(E-Mail Removed)...
> I have a dropdownlist ,for which i think the selectindexchnaged event is

not
> getting fired. Please help.
> Thanks,
>
> Here is the code:
>
> public class class1: Systems.Web.UI.Page
> {
> //all the declarations
> public void GetItems()
> {
> // GetConnection is a function that gets connection string and

opens
> the
> //connection
> SqlConnection myConn = GetConnection();
> DataSet dsTemp;
> dsTemp = new DataSet();
> string strSQl ="Select name from Company";
> SqlDataAdapter myAda = new SQlAdapter(strSQL,myConn);
> myAda.Fill(dsTemp,"temptab");
> DDLName.DataSource = dsTemp.Tables["temptab"];
> DDLName.DataTextField = dsTemp.Tables["temptab"].Columns[0].ToString();
> DDLName.DataValueField = dsTemp.Tables["temptab"].Columns[0].ToString();
> DDLName.DataBind();
> myConn.Close();
> }
> public void DDLName_SelectedIndexChanged(object sernder,EventArgs e)
> {
> lblLabel2.Text = "Event Fired" + DDLName.SelectItem.Text;
> /// Do some things here like set another DDL List according to
> selectedItem
> }
> private void Page_Load(object sender,EventArgs e)
> {
> DDLName.AutoPostBack = true;
> DDLName.EnableViewState = false;
> if(!Postback)
> {
> GetItems();
> }
> }
> protected override void OnInit(EventArgs e)
> {
> DDLName.SelectedIndexChanged += new
> EventHandler(DDLName_SelectedIndexChanged);
> }
> }



 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
About Dropdownlist ..urgent. =?Utf-8?B?RGFuaWVs?= Microsoft ASP .NET 2 23rd Sep 2004 04:40 PM
Urgent help with ItemTemplate (datagrid) - databound DropDownList VB Programmer Microsoft ASP .NET 6 1st Sep 2004 09:08 PM
Urgent Help on finding a word in asp:DropDownList =?Utf-8?B?bWFl?= Microsoft ASP .NET 2 17th Mar 2004 02:23 AM
dropdownlist control-urgent reiks Microsoft ASP .NET 1 17th Dec 2003 02:43 PM
dropdownlist control -urgent reiks Microsoft Dot NET 0 17th Dec 2003 01:30 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 07:56 PM.