Hi,
I have the following radgrid integrated to my application.
I need to extract the company ids which is in the second column in the grid and use that to redirect to a different page.
I have used the following code:
However the above doesn't work.
Please suggest I can i extract the data from the seconds column.
Thanks,
Debashis
I have the following radgrid integrated to my application.
<telerik:RadGrid ID="grdCompanyList" runat="server" GridLines="None" AutoGenerateColumns="False" AllowSorting="True" AllowFilteringByColumn = "True" AllowPaging="True" EnableLinqExpressions="False" PageSize="10" OnNeedDataSource="grdCompanyList_NeedDataSource" OnItemCreated="grdCompanyList_ItemCreated"> <PagerStyle Mode="NextPrevAndNumeric"></PagerStyle> <MasterTableView DataKeyNames="watchlist_id" CommandItemDisplay="Top" EditMode="PopUp"> <CommandItemSettings ShowAddNewRecordButton="false"/> <Columns> <telerik:GridBoundColumn DataField="watchlist_id" DataType="System.Int32" HeaderText="watchlist_id" ReadOnly="True" SortExpression="watchlist_id" UniqueName="watchlist_id" Visible="false" > </telerik:GridBoundColumn> <telerik:GridBoundColumn DataField="company_id" DataType="System.Int32" HeaderText="company_id" ReadOnly="True" SortExpression="company_id" UniqueName="company_id" Visible="false" > </telerik:GridBoundColumn> <telerik:GridTemplateColumn AllowFiltering="false" ItemStyle-Width="180px"> <ItemTemplate> <asp:Image width="142" height="58" ID="CompLogos" ImageUrl="<%# showCompLogo(Container.DataItem) %>" runat="server" AlternateText="Logo" /> </ItemTemplate> </telerik:GridTemplateColumn> <telerik:GridBoundColumn DataField="company_name" HeaderText="Company name" SortExpression="company_name" ItemStyle-Width="450" UniqueName="company_name" ReadOnly="true"> <ItemStyle Width="450px" /> </telerik:GridBoundColumn> <telerik:GridTemplateColumn AllowFiltering="false" ItemStyle-Width="50px"> <ItemTemplate> <asp:HyperLink ID="CoLink" runat="server" Text="Edit" ImageUrl="~/images/viewicon_big.png" ToolTip="View Details"></asp:HyperLink> </ItemTemplate> </telerik:GridTemplateColumn> </Columns> </MasterTableView> <ClientSettings EnableRowHoverStyle="true"></ClientSettings> </telerik:RadGrid>I need to extract the company ids which is in the second column in the grid and use that to redirect to a different page.
I have used the following code:
protected void grdCompanyList_ItemCreated(object sender, GridItemEventArgs e) { if (e.Item is GridDataItem) { HyperLink CoLink = (HyperLink)e.Item.FindControl("CoLink"); GridDataItem item = (GridDataItem)e.Item; string Cid = item["company_id"].Text; CoLink.Attributes["href"] = "CompanyDetails.aspx?Id=" + Cid; } }However the above doesn't work.
Please suggest I can i extract the data from the seconds column.
Thanks,
Debashis