hi
-
I have an application in which I fill a listbox with values from a dataset. But the listbox is filled with 'system.data.datarowview' here the values are displayed correctly.But when the page is load for the 1st time tha list box showing 'system.data.datarowview'after click on dat dat coming..plz help me i ve writen the code like con.Open(); SqlDataAdapter adp= new SqlDataAdapter(lstrsql,con); DataSet objds=new DataSet(); adp.Fill(objds); lst_emp.DataTextField=objds.Tables[0].Columns["txtval"].ToString(); lst_emp.DataValueField=objds.Tables[0].Columns["emp_id"].ToString(); lst_emp.DataSource = objds; lst_emp.DataBind();
-
I have an application in which I fill a listbox with values from a dataset. But the listbox is filled with 'system.data.datarowview' here the values are displayed correctly.But when the page is load for the 1st time tha list box showing 'system.data.datarowview'after click on dat dat coming..plz help me i ve writen the code like con.Open(); SqlDataAdapter adp= new SqlDataAdapter(lstrsql,con); DataSet objds=new DataSet(); adp.Fill(objds); lst_emp.DataTextField=objds.Tables[0].Columns["txtval"].ToString(); lst_emp.DataValueField=objds.Tables[0].Columns["emp_id"].ToString(); lst_emp.DataSource = objds; lst_emp.DataBind();
Wrong forum, try posting your question in the C# forum. Also it would be better if you provided a descriptive subject line, rather than 'Hi' or 'Hello' or 'Urgent' etc.
Steve Jowett ------------------------- It is offen dangerous to try and see someone else's point of view, without proper training. Douglas Adams (Mostly Harmless)
-
I have an application in which I fill a listbox with values from a dataset. But the listbox is filled with 'system.data.datarowview' here the values are displayed correctly.But when the page is load for the 1st time tha list box showing 'system.data.datarowview'after click on dat dat coming..plz help me i ve writen the code like con.Open(); SqlDataAdapter adp= new SqlDataAdapter(lstrsql,con); DataSet objds=new DataSet(); adp.Fill(objds); lst_emp.DataTextField=objds.Tables[0].Columns["txtval"].ToString(); lst_emp.DataValueField=objds.Tables[0].Columns["emp_id"].ToString(); lst_emp.DataSource = objds; lst_emp.DataBind();
Hi.... you need to change the below lines...
mon***z wrote:
lst_emp.DataTextField=objds.Tables[0].Columns["txtval"].ToString(); lst_emp.DataValueField=objds.Tables[0].Columns["emp_id"].ToString();
to......
lst_emp.DataTextField = "txtval"; lst_emp.DataValueField = "emp_id";
Regards, Sandeep Kumar.V
-
I have an application in which I fill a listbox with values from a dataset. But the listbox is filled with 'system.data.datarowview' here the values are displayed correctly.But when the page is load for the 1st time tha list box showing 'system.data.datarowview'after click on dat dat coming..plz help me i ve writen the code like con.Open(); SqlDataAdapter adp= new SqlDataAdapter(lstrsql,con); DataSet objds=new DataSet(); adp.Fill(objds); lst_emp.DataTextField=objds.Tables[0].Columns["txtval"].ToString(); lst_emp.DataValueField=objds.Tables[0].Columns["emp_id"].ToString(); lst_emp.DataSource = objds; lst_emp.DataBind();
con.Open(); SqlDataAdapter adp= new SqlDataAdapter(lstrsql,con); DataSet objds=new DataSet(); adp.Fill(objds); lst_emp.DataSource = objds.Tables[0].DefaultView cmbBookFrom.ValueMember = "emp_id" cmbBookFrom.DisplayMember = "txtval"
i think this will make your life easier :-\