Hello, i have some problem with ClientSelectColumn of Radgridview
in Radgrid1 : i want when i select a checkbox or select full checkbox and click TEST button , i can binding all rows selected from grid1 to grid2 or getting primary key(column makh) of all rows selected
What should i do ?
THANK
http://nguy-hiem.co.cc/share/hoi.png
in Radgrid1 : i want when i select a checkbox or select full checkbox and click TEST button , i can binding all rows selected from grid1 to grid2 or getting primary key(column makh) of all rows selected
What should i do ?
THANK
http://nguy-hiem.co.cc/share/hoi.png
15 Answers, 1 is accepted
0
Princy
Top achievements
Rank 2
answered on 21 Apr 2011, 10:35 AM
Hello,
Try the following code snippet to loop through the Selected rows in a Grid. Set the required key field as the DataKeyName.
aspx:
C#:
Note: You can try the following approach to persist the selected row after postback.
Persisting the selected rows on sorting/paging/filtering/grouping
Thanks,
Princy.
Try the following code snippet to loop through the Selected rows in a Grid. Set the required key field as the DataKeyName.
aspx:
<MasterTableView DataKeyNames="EmployeeID" >C#:
foreach (GridDataItem item in RadGrid1.SelectedItems) { string strKey = item.GetDataKeyValue("EmployeeID").ToString(); }Persisting the selected rows on sorting/paging/filtering/grouping
Thanks,
Princy.
0
trunghieu
Top achievements
Rank 1
answered on 23 Apr 2011, 08:30 PM
Thanks,but now i have a question,what event happened when i select a checkbox
http://nguy-hiem.co.cc/share/234.png
THANKS !
http://nguy-hiem.co.cc/share/234.png
THANKS !
0
Shinu
Top achievements
Rank 2
answered on 26 Apr 2011, 06:08 AM
Hello Trunghieu,
The OnRowSelected client side event fires when a row is selected in grid. Attach the 'OnRowSelected' and handle the event.
Thanks,
Shinu.
The OnRowSelected client side event fires when a row is selected in grid. Attach the 'OnRowSelected' and handle the event.
Thanks,
Shinu.
0
trunghieu
Top achievements
Rank 1
answered on 12 May 2011, 10:05 AM
Hello, i want enable textbox1 (on server) using javascript , i using Client-OnRowSelected in radgrid,but not run
This's my code
txtsl in Template COlumn
http://nguy-hiem.co.cc/share/im.png
and i have a question,how to get value in textbox (txtsl) in radgrid
Thank !
This's my code
<ClientSettings ClientEvents-OnRowSelected="onrowclick" > <Selecting AllowRowSelect="True" /> </ClientSettings><script language="javascript"> function onrowclick() { var a=document.getElementById('txtsl'); a.style.Enabled=true; } </script>http://nguy-hiem.co.cc/share/im.png
and i have a question,how to get value in textbox (txtsl) in radgrid
Thank !
0
Shinu
Top achievements
Rank 2
answered on 12 May 2011, 11:00 AM
Hello,
Since the TextBox is inside the ItemTemplate, you cannot access the it directly.
Try the following client side code to enable the TextBox from client side OnRowSelected event.
Javascript:
Thanks,
Shinu.
Since the TextBox is inside the ItemTemplate, you cannot access the it directly.
Try the following client side code to enable the TextBox from client side OnRowSelected event.
Javascript:
function OnRowSelected(sender, args) { args.get_gridDataItem(args.get_itemIndexHierarchical()).findElement("txtsl").disabled = false; }Thanks,
Shinu.
0
trunghieu
Top achievements
Rank 1
answered on 12 May 2011, 02:51 PM
Thank you ! but still not run
0
Shinu
Top achievements
Rank 2
answered on 13 May 2011, 05:43 AM
Hello Trunghieu,
I am not sure about the issue you are facing. Here am pasting the full code I tried. Please check it with your code and let me know if you need any further assistance.
aspx:
Javascript:
Thanks,
Shinu.
I am not sure about the issue you are facing. Here am pasting the full code I tried. Please check it with your code and let me know if you need any further assistance.
aspx:
<telerik:RadGrid EnableEmbeddedSkins="true" ID="rad" runat="server" Width="600px" DataSourceID="SqlDataSource1" AutoGenerateEditColumn="true" > <MasterTableView DataKeyNames="EmployeeID" AllowPaging="true" EditMode="EditForms"> <Columns> <telerik:GridBoundColumn DataField="EmployeeID" Aggregate="Count" HeaderText="EmployeeID" UniqueName="EmployeeID"> </telerik:GridBoundColumn> <telerik:GridTemplateColumn UniqueName="TemplateColumn1"> <ItemTemplate> <asp:TextBox ID="txt1" runat="server" Enabled="false"> </asp:TextBox> </ItemTemplate> <EditItemTemplate> <asp:TextBox ID="TextBox2" runat="server"></asp:TextBox> </EditItemTemplate> </telerik:GridTemplateColumn> </Columns> </MasterTableView> <ClientSettings ClientEvents-OnRowSelected="OnRowSelected"> <Selecting AllowRowSelect="true" /> </ClientSettings></telerik:RadGrid>Javascript:
<script type="text/javascript"> function OnRowSelected(sender, args) { args.get_gridDataItem(args.get_itemIndexHierarchical()).findElement("txt1").disabled = false; }</script>Thanks,
Shinu.
0
trunghieu
Top achievements
Rank 1
answered on 26 May 2011, 07:25 AM
Thank you,now i have a question please help me.i want when i checked client select column and press OK button i can get all of info in that row (row i seleted)
example:
http://demos.telerik.com/aspnet-ajax/grid/examples/programming/draganddrop/defaultcs.aspx
when i press a button i can get orderID,CustomerID,Company,Date on this row
THANK !
example:
http://demos.telerik.com/aspnet-ajax/grid/examples/programming/draganddrop/defaultcs.aspx
when i press a button i can get orderID,CustomerID,Company,Date on this row
THANK !
0
Shinu
Top achievements
Rank 2
answered on 26 May 2011, 08:42 AM
Hello Trunghieu,
You can access the selected row items as shown below.
C#:
Also take a look at the following documentation.
Accessing cells and rows.
Thanks,
Shinu.
You can access the selected row items as shown below.
C#:
foreach(GridDataItem item in RadGrid1.SelectedItems)//loops through selected row { String s= item["ColumnUniqueName"].Text; }Accessing cells and rows.
Thanks,
Shinu.
0
trunghieu
Top achievements
Rank 1
answered on 26 May 2011, 08:45 AM
Thank ! but i don't using column unique, i using RadGrid1.datasource = datatable,how to get unique column ?
0
Shinu
Top achievements
Rank 2
answered on 26 May 2011, 10:29 AM
Hello Trunghieu,
Give a try with the following approach.
C#:
Give a try with the following approach.
C#:
foreach(GridDataItem item in RadGrid1.SelectedItems)//loops through selected row{ foreach (GridColumn col in RadGrid1.MasterTableView.Columns) { item[col.UniqueName].Text }}
Thanks,
Shinu. 0
trunghieu
Top achievements
Rank 1
answered on 06 Jun 2011, 07:30 PM
Thank Shiru,but i want to get exactly column 3 and 5,what should i do ??
Thank !
Thank !
0
Shinu
Top achievements
Rank 2
answered on 07 Jun 2011, 05:46 AM
Hello Trunghieu,
Try the following approach to get the columns 3 and 5.
C#:
Try the following approach to get the columns 3 and 5.
C#:
int count = 0;foreach (GridColumn col in RadGrid2.MasterTableView.Columns) { if (count == 3 || count == 5) { item[col.UniqueName].Text = "hhhhhhhhh";
}
count++;//Increments the count
}
Thanks,
Shinu.
0
trunghieu
Top achievements
Rank 1
answered on 07 Jun 2011, 08:56 AM
Thank Shiru , but i think your code not run because count=3 or 5 count++,but frist count=0 so count never = 3
Thank !
Thank !
0
Shinu
Top achievements
Rank 2
answered on 07 Jun 2011, 03:26 PM
Hi ,
Sorry for the mistake. I have edited the code.
Hope it helps you.
Thanks,
Shinu.
Sorry for the mistake. I have edited the code.
Hope it helps you.
Thanks,
Shinu.