问题
I can write a code. In this I can take a Template Column & in this I build a RadCombobox. When it's Index changed I want to affect the below text box. Link the selected value of the Combo box is set as Text on Below TextBox. Combo Box & Text Box are different Controls of Different Template Column.
I can Write Control of Combo box like this :
<telerik:RadComboBox ID="cmbGID" runat="server" DataSourceID="SqlDataSource8" DataTextField="Name"
DataValueField="ID" AutoPostBack="True" OnSelectedIndexChanged="cmbGID_SelectedIndexChanged">
But I don't know the parameters of this event like this :
protected void cmbGID_SelectedIndexChanged()
{
//code...
}
Any one plz tell me that parameters & tell me is that possible to set txtValue.Text = cmbGID.SelectedValue.ToString()...???
回答1:
I got the solution of this problem...
This is working by following code :
protected void cmbGrp_SelectedIndexChanged(object sender, RadComboBoxSelectedIndexChangedEventArgs e)
{
RadComboBox ddlCtrl = sender as RadComboBox;
GridEditableItem dataItem = ddlCtrl.NamingContainer as GridEditableItem;
RadComboBox cmbCtrl = dataItem.FindControl("cmbSetNo") as RadComboBox;
RadTextBox txtCtrl = dataItem.FindControl("cmbSetNo") as RadTextBox;
txtCtrl.Text = ddlctrl.SelectedValue.ToString();
string query = "QUERY";
ds.Clear();
ds = c.getDataSet(query);
cmbCtrl.DataSource = ds.Tables[0];
cmbCtrl.DataTextField = "NO";
cmbCtrl.DataValueField = "RecordID";
cmbCtrl.DataBind();
}
回答2:
Something like this should work:
protected void vmbGID_SelectedIndexChanged(object sender, EventArgs e)
{
var ddlCtrl = sender as RadComboBox;
if (ddlCtrl != null)
{
var dataItem = ddlCtrl.Parent as GridDataItem;
if (dataItem != null)
{
var txtCtrl = dataItem.FindControl("txtValue") as RadTextBox;
if (txtCtrl != null)
{
txtCtrl.Text = ddlCtrl.SelectedValue;
}
}
}
}
来源:https://stackoverflow.com/questions/10034024/index-change-event-for-combobox-of-gridtemplatecolumn-in-telerik