This is a migrated thread and some comments may be shown as answers.
Binding details of the selected item in a Radcombobox of a Radgrid to a textbox of the same Radgrid
0 Answers 10 Views
This is a migrated thread and some comments may be shown as answers.
Kavitha
Top achievements
Rank 1
Kavitha asked on 10 Sep 2013, 04:06 AM
Hi All

I need to bind the address field of a bank name choosen in a Radcombobox of a radgrid to a next template's textbox.  My aspx code is given below.

 

 

 

 

 

 

<telerik:RadGrid ID="RGBankCash" runat="server" DataSourceID="BankDataSource"

 

 

 

 

 

GridLines="None" Skin="Vista" Width="500px" AllowPaging ="true "

 

 

 

 

 

ondeletecommand="RGBankCash_DeleteCommand" PageSize ="10"

 

 

 

 

 

oninsertcommand="RGBankCash_InsertCommand"

 

 

 

 

 

onupdatecommand="RGBankCash_UpdateCommand"

 

 

 

 

 

OnItemDataBound="RGBankCash_ItemDataBound">

 

 

 

 

 

 

 

<Columns>

 

 

 

 

 

 

<telerik:GridBoundColumn DataField="BankKey" DataType="System.Int32"

 

 

 

 

 

 

HeaderText="BankKey" ReadOnly="True" SortExpression="BankKey"

 

 

 

 

 

 

UniqueName="BankKey" Visible="False">

 

 

 

 

 

 

</telerik:GridBoundColumn>

 

 

 

 

 

 

<telerik:GridTemplateColumn DataField="BankName" FilterControlWidth="150px"

 

 

 

 

 

 

HeaderText="Bank Name" SortExpression="BankName" UniqueName="BankName">

 

 

 

 

 

 

<EditItemTemplate>

 

 

 

 

 

 

<telerik:RadComboBox ID="BankKeyRadComboBox" Runat="server"

 

 

 

 

 

 

DataSourceID="BankDS" Skin="Vista" DataTextField="BankName"

 

 

 

 

 

 

DataValueField="BankKey" SelectedValue='<%# Bind("BankKey") %>' Autopostback="true" >

 

 

 

 

 

 

</telerik:RadComboBox>

 

 

 

 

 

 

</EditItemTemplate>

 

 

 

 

 

 

<ItemTemplate>

 

 

 

 

 

 

<asp:Label ID="BankKeyLabel" runat="server"

 

 

 

 

 

 

Text='<%# Eval("BankName") %>'></asp:Label>

 

 

 

 

 

 

</ItemTemplate>

 

 

 

 

 

 

<HeaderStyle Width="250px" />

 

 

 

 

 

 

</telerik:GridTemplateColumn>

 

 

 

 

 

 

<telerik:GridTemplateColumn DataField="BankAddress" HeaderText="Bank Address" FilterControlWidth="200px"

 

 

 

 

 

 

SortExpression="BankAddress" UniqueName="BankAddress" ItemStyle-HorizontalAlign = "Center">

 

 

 

 

 

 

<EditItemTemplate>

 

 

 

 

 

 

<asp:TextBox ID="BankAddressTextBox" runat="server"

 

 

 

 

 

 

Text='<%# Bind("BankAddress") %>' Width="300px"></asp:TextBox>

 

 

 

 

 

 

<asp:RequiredFieldValidator ID="RequiredFieldValidator3"

 

 

 

 

 

 

runat="server" ErrorMessage="Please Enter Bank Address!"

 

 

 

 

 

 

Display="Dynamic" SetFocusOnError="true" ControlToValidate = "BankAddressTextBox" style="color: #FF0000">

 

 

 

 

 

 

</asp:RequiredFieldValidator>

 

 

 

 

 

 

</EditItemTemplate>

 

 

 

 

 

 

<ItemTemplate>

 

 

 

 

 

 

<asp:Label ID="BankAddressLabel" runat="server"

 

 

 

 

 

 

Text='<%# Eval("BankAddress") %>'></asp:Label>

 

 

 

 

 

 

</ItemTemplate>

 

 

 

 

 

 

<HeaderStyle Width="200px" />

 

 

 

 

 

 

<ItemStyle HorizontalAlign="Left"></ItemStyle>

 

 

 

 

 

 

</telerik:GridTemplateColumn>










 

 

 

 

 

 

<asp:SqlDataSource ID="BankDS" runat="server"

 

 

 

 

 

ProviderName="System.Data.SqlClient"

 

 

 

 

 

DataSourceMode="DataReader"

 

 

 

 

 

onload="BankDS_Load">

 

 

 

 

 

</asp:SqlDataSource>

My Code behind is

 

 

 

 

 

protected void RGBankCash_ItemDataBound(object sender, GridItemEventArgs e)

{

 

 

 

 

 

if (e.Item is GridDataItem)

{

 

 

 

 

 

GridDataItem insertItem = (GridDataItem)e.Item;

 

 

 

 

 

RadComboBox combo = (RadComboBox)insertItem.FindControl("BankKeyRadComboBox");

combo.AutoPostBack =

 

 

 

 

 

true;

combo.SelectedIndexChanged +=

 

 

 

 

 

new RadComboBoxSelectedIndexChangedEventHandler(this.combo_SelectedIndexChanged);

}

}

 

 

 

 

 

private void combo_SelectedIndexChanged(object sender, RadComboBoxSelectedIndexChangedEventArgs e)

{

}

 How to write remaining code?

 

 

 

 

 

 

 

 

 

 

No answers yet. Maybe you can help?

Asked by
Kavitha
Top achievements
Rank 1
Share this question
or