Hi,
How to assign the values from selected row of the radgrid to
textboxes which is outside of radgrid in server side coding.
Please find me the solution as soon as possible.
Note: im using classic radgrid.
Regards,
Asif
How to assign the values from selected row of the radgrid to
Page1.aspx:
<script language=
"javascript"
>
function callShow()
{
if
(window[
"<%=RadGrid1.ClientID %>"
].MasterTableView.SelectedRows.length > 0)
{
var selectedRows = window[
"<%=RadGrid1.ClientID %>"
].MasterTableView.SelectedRows[0];
window[
"<%= RadGrid1.ClientID %>"
].AjaxRequest(
"<%= RadGrid1.UniqueID %>"
,
"No|"
+ selectedRows.KeyValues[
"No"
]);
}
}
</script>
<html>
<asp:UpdatePanel ID=
"updatePanel1"
runat=
"server"
UpdateMode=
"Conditional"
>
<ContentTemplate>
<asp:TextBox ID=
"txtNo"
runat=
"server"
/>
<asp:TextBox ID=
"txtName"
runat=
"server"
/>
</ContentTemplate>
</asp:UpdatePanel>
..
..
<radG:RadGrid ID=
"RadGrid1"
runat=
"server"
AllowPaging=
"true"
GridLines=
"None"
Skin=
"Office2007"
AllowSorting=
"false"
EnableAJAX=
"true"
AutoGenerateColumns=
"false"
>
<MasterTableView AutoGenerateColumns=
"False"
DataKeyNames=
"No"
>
<Columns>
<radG:GridBoundColumn DataField=
"No"
UniqueName=
"No"
HeaderText=
"No"
> </radG:GridBoundColumn>
<radG:GridBoundColumn DataField=
"Name"
UniqueName=
"Name"
HeaderText=
"Name"
> </radG:GridBoundColumn>
</Columns>
</MasterTableView>
<ClientSettings EnableClientKeyValues=
"true"
>
<Selecting AllowRowSelect=
"true"
/>
<ClientEvents OnRowSelected=
"callShow"
/>
</ClientSettings>
</radG:RadGrid>
</html>
Page1.aspx.cs:
protected
override
void
RaisePostBackEvent(IPostBackEventHandler sourceControl,
string
eventArgument)
{
if
(eventArgument !=
null
)
{
if
(eventArgument.StartsWith(
"No"
))
{
string
[] arr1 = eventArgument.Split(
new
char
[] {
'|'
});
txtNo.Text = arr1[1].ToString();
}
}
}
Please find me the solution as soon as possible.
Note: im using classic radgrid.
Regards,
Asif