HI,
I am yogesh. i am working with asp.net ajax rad grid. i need to add checkbox column programmatically and should be able to select multiple rows and export to excel...could anyone help me out plz....its urgent(asp.net with c# code)
I am yogesh. i am working with asp.net ajax rad grid. i need to add checkbox column programmatically and should be able to select multiple rows and export to excel...could anyone help me out plz....its urgent(asp.net with c# code)
7 Answers, 1 is accepted
0
Jayesh Goyani
Top achievements
Rank 2
answered on 28 Feb 2011, 12:00 PM
hi yogesh,
code for add checkbox column programmatically
GridClientSelectColumn objGridClientSelectColumn = new GridClientSelectColumn();
objGridClientSelectColumn.UniqueName = "UniqueName";
rgTableLibrary.MasterTableView.Columns.Add(objGridClientSelectColumn);
plz set AllowMultiRowSelection="true"
for more help of dynamic creation of column http://demos.telerik.com/aspnet-ajax/grid/examples/programming/groupby/defaultcs.aspx
for export http://demos.telerik.com/aspnet-ajax/grid/examples/generalfeatures/exporting/defaultcs.aspx
Thanks,
Jayesh Goyani
code for add checkbox column programmatically
GridClientSelectColumn objGridClientSelectColumn = new GridClientSelectColumn();
objGridClientSelectColumn.UniqueName = "UniqueName";
rgTableLibrary.MasterTableView.Columns.Add(objGridClientSelectColumn);
plz set AllowMultiRowSelection="true"
for more help of dynamic creation of column http://demos.telerik.com/aspnet-ajax/grid/examples/programming/groupby/defaultcs.aspx
for export http://demos.telerik.com/aspnet-ajax/grid/examples/generalfeatures/exporting/defaultcs.aspx
Thanks,
Jayesh Goyani
0
yogesh
Top achievements
Rank 1
answered on 28 Feb 2011, 12:45 PM
Thanks a lot jayesh..its working fine. now i have an issue like..." I should export the row of radgrid which i have checked in the checkbox column to pdf,excel,word...colud you plz send me the code...it should allow multi row selection also.
Thankyou,
Regards,
yogesh
Thankyou,
Regards,
yogesh
0
Jayesh Goyani
Top achievements
Rank 2
answered on 01 Mar 2011, 09:29 AM
hi yogesh,
for export seleted rows....
Thanks,
Jayesh Goyani
for export seleted rows....
foreach (GridItem item in radgrdExtraActivity.MasterTableView.GetItems(new GridItemType[] { GridItemType.Item, GridItemType.AlternatingItem })) { GridDataItem dataitem = (GridDataItem)item; TableCell cell = dataitem["ClientSelectColumn"]; CheckBox checkBox = (CheckBox)cell.Controls[0]; if (!checkBox.Checked) { dataitem.Dispose(); } } radgrdExtraActivity.MasterTableView.ExportToExcel();<telerik:RadGrid ID="radgrdExtraActivity" runat="server" AllowMultiRowSelection="true"> <MasterTableView> <Columns> <telerik:GridClientSelectColumn UniqueName="ClientSelectColumn" /> </Columns> </MasterTableView></telerik:RadGrid>Thanks,
Jayesh Goyani
0
K
Top achievements
Rank 1
answered on 09 May 2011, 04:51 PM
I have a Rad grid with a check box column which I have set AutoPostBack to true cause I when the checkbox is clicked I want to save some values into the database however the onCheckedChanged event is not fired when I click on the checkbox. I need to get this done asap so any help is appreciated. Thanks.
0
Jayesh Goyani
Top achievements
Rank 2
answered on 11 May 2011, 07:00 AM
Hi k,
Thanks,
Jayesh Goyani
<MasterTableView DataKeyNames="ActionMenuID"> <Columns> <telerik:GridTemplateColumn> <ItemTemplate> <asp:CheckBox ID="chkTest" runat="server" AutoPostBack="true" OnCheckedChanged="chkTest_CheckedChanged" /> </ItemTemplate> </telerik:GridTemplateColumn> </Columns>protected void chkTest_CheckedChanged(object sender, EventArgs e) { CheckBox chkTest = sender as CheckBox; GridDataItem item = (GridDataItem)chkTest.NamingContainer; string s1 = item.GetDataKeyValue("ActionMenuID").ToString(); // your DB insert shold be here }Thanks,
Jayesh Goyani
0
Brijesh Gadhiya
Top achievements
Rank 1
answered on 09 Aug 2013, 07:02 PM
Awesome!
That was exactly what I was looking for.
That was exactly what I was looking for.
0
Meenakshi
Top achievements
Rank 1
answered on 29 Oct 2015, 01:29 PM
I placed checkbox as templatecolumn and I want to show the 1 or 0 values on the checkbox in pageload. Also want to check and value and store the checkbox value in database. Could you please help me in this regard.
<telerik:GridTemplateColumn HeaderText="IsActive" UniqueName="IsActive">
<ItemTemplate>
<asp:CheckBox ID="chkActive" runat="server" AutoPostBack="true" Visible="true" />
</ItemTemplate>
</telerik:GridTemplateColumn>
Active datafield hold 1/0 in database and need to show the value of checkbox when page is loading on the Radgrid.