I'm trying to Display the selected record in a asp.formview on the same page as the RadGrid.
When I click the 'Select' (GridButtonColumn) Button no Redirect occurs.
If I type in the entire Page URL with a QueryString value (http://10.0.0.110/Listing1.aspx?id=781) the formview displays the record.
Here is the code:
CodeBehind:
Thank you in advance!
Mike
When I click the 'Select' (GridButtonColumn) Button no Redirect occurs.
If I type in the entire Page URL with a QueryString value (http://10.0.0.110/Listing1.aspx?id=781) the formview displays the record.
Here is the code:
<
telerik:RadGrid
ID
=
"RadGrid1"
runat
=
"server"
AllowFilteringByColumn
=
"True"
AllowPaging
=
"True"
AllowSorting
=
"True"
DataSourceID
=
"SqlDataSource1"
GridLines
=
"None"
Height
=
"700px"
PageSize
=
"20"
>
<
ClientSettings
AllowColumnsReorder
=
"True"
>
<
Selecting
AllowRowSelect
=
"True"
/>
<
Scrolling
AllowScroll
=
"True"
UseStaticHeaders
=
"True"
/>
</
ClientSettings
>
<
MasterTableView
datasourceid
=
"SqlDataSource1"
DataKeyNames
=
"id"
>
<
Columns
>
<
telerik:GridButtonColumn
CommandName
=
"Redirect"
Text
=
"Select"
ButtonType
=
"PushButton"
UniqueName
=
"ButtonColumn"
>
<
HeaderStyle
Width
=
"70px"
/>
</
telerik:GridButtonColumn
>
</
Columns
>
<
RowIndicatorColumn
>
<
HeaderStyle
Width
=
"20px"
></
HeaderStyle
>
</
RowIndicatorColumn
>
<
ExpandCollapseColumn
>
<
HeaderStyle
Width
=
"20px"
></
HeaderStyle
>
</
ExpandCollapseColumn
>
<
NoRecordsTemplate
>
Sorry No Records Found, Modify your search and try again.
</
NoRecordsTemplate
>
</
MasterTableView
>
<
PagerStyle
Position
=
"TopAndBottom"
/>
</
telerik:RadGrid
>
protected
void
RadGrid1_ItemCommand(
object
source, GridCommandEventArgs e)
{
if
(e.CommandName ==
"Redirect"
)
{
GridDataItem item = (GridDataItem)e.Item;
string
value = item.GetDataKeyValue(
"id"
).ToString();
// Get the value in clicked row
// Save the required value in session
string
url =
"listing1.aspx?id="
+ value;
Response.Redirect(url);
}
}
Thank you in advance!
Mike