Hi,
I have a scenario where I display huge data and edit them using pop-up..
Some of my fields need to be comboboxes...where data has to be binded to tht particulat value for that resource..
I have a table employee...which has status (active,inactive)...but I need to bind this data from a look up table..
EmploymentStatus: <telerik:RadComboBox ID="ddlStatus" runat="server" AppendDataBoundItems="true" AllowCustomText="true" > </telerik:RadComboBox>
I have tried the below code to bind the values:but it didn't wok..getting null value in to the list object..
protected void RadGrid1_ItemCommand(object source, GridCommandEventArgs e)
{
if (e.CommandName == "Edit")
{
GridEditableItem item = e.Item as GridEditableItem;
RadComboBox list = item.FindControl("ddlStatus") as RadComboBox;
SqlDataReader ddDR = null;
myCommand.CommandText = "SELECT [Name],[value] FROM [Table1] where Name='Status'";
myConnection = new SqlConnection(myConnectionstr);
myConnection.Open();
myCommand.CommandType = CommandType.Text;
myCommand.Connection = myConnection;
ddDR = myCommand.ExecuteReader();
list.DataSource = ddDR;
list.DataTextField = "Name";
list.DataValueField = "Value";
list.DataBind();
ddDR.Dispose();
myCommand.Dispose();
myConnection.Dispose();
}
}
Can you please let me know how do I bind the data and also get the correct values when i click edit and empty value when I click insert...Will be of gr8 help..
Please advise..
thanks
I have a scenario where I display huge data and edit them using pop-up..
Some of my fields need to be comboboxes...where data has to be binded to tht particulat value for that resource..
I have a table employee...which has status (active,inactive)...but I need to bind this data from a look up table..
EmploymentStatus: <telerik:RadComboBox ID="ddlStatus" runat="server" AppendDataBoundItems="true" AllowCustomText="true" > </telerik:RadComboBox>
I have tried the below code to bind the values:but it didn't wok..getting null value in to the list object..
protected void RadGrid1_ItemCommand(object source, GridCommandEventArgs e)
{
if (e.CommandName == "Edit")
{
GridEditableItem item = e.Item as GridEditableItem;
RadComboBox list = item.FindControl("ddlStatus") as RadComboBox;
SqlDataReader ddDR = null;
myCommand.CommandText = "SELECT [Name],[value] FROM [Table1] where Name='Status'";
myConnection = new SqlConnection(myConnectionstr);
myConnection.Open();
myCommand.CommandType = CommandType.Text;
myCommand.Connection = myConnection;
ddDR = myCommand.ExecuteReader();
list.DataSource = ddDR;
list.DataTextField = "Name";
list.DataValueField = "Value";
list.DataBind();
ddDR.Dispose();
myCommand.Dispose();
myConnection.Dispose();
}
}
Can you please let me know how do I bind the data and also get the correct values when i click edit and empty value when I click insert...Will be of gr8 help..
Please advise..
thanks