Hi im trying to do something and i cant find they way to do it...
Here is what i want to do...
I have a RadComboBox filled with a datasource and i want to have a button to add what i have selected in the RCB to a temp Radgrid (i got to be able to add as rows as i need from the same RCB) plus i need to be added an editable checkbox column for each row...
i dont want to save anything to database. i just need this radgrid to display the info. My codebehind is VB
Hope someone can help me... and Thanks!
Carlos.
Here is what i want to do...
I have a RadComboBox filled with a datasource and i want to have a button to add what i have selected in the RCB to a temp Radgrid (i got to be able to add as rows as i need from the same RCB) plus i need to be added an editable checkbox column for each row...
i dont want to save anything to database. i just need this radgrid to display the info. My codebehind is VB
Hope someone can help me... and Thanks!
Carlos.
4 Answers, 1 is accepted
0
Hi Carlos,
To achieve the desired functionality you could try keeping a temporary DataTable into the Session and bind the RadGrid to it:
When the user clicks add button you could add new row into the table and rebind the RadGrid:
Additionally I am sending you a simple example. Please check it out and let me know if it helps you.
Looking forward for your reply.
All the best,
Radoslav
the Telerik team
To achieve the desired functionality you could try keeping a temporary DataTable into the Session and bind the RadGrid to it:
Public Property MyDataTable() As DataTable Get If Session("MyDataTable") Is Nothing Then Session("MyDataTable") = New DataTable() End If Return CType(Session("MyDataTable"), DataTable) End Get Set(ByVal Value As DataTable) Session("MyDataTable") = Value End Set End PropertyProtected Sub RadGrid1_NeedDataSource(ByVal sender As Object, ByVal e As Telerik.Web.UI.GridNeedDataSourceEventArgs) Handles RadGrid1.NeedDataSource RadGrid1.DataSource = MyDataTableEnd SubWhen the user clicks add button you could add new row into the table and rebind the RadGrid:
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click If MyDataTable.Columns.Count = 0 Then MyDataTable.Columns.Add("ProductName") End If Dim selectedvalue As String = RadComboBox2.SelectedItem.Text MyDataTable.Rows.Add(selectedvalue) RadGrid1.Rebind() End SubAdditionally I am sending you a simple example. Please check it out and let me know if it helps you.
Looking forward for your reply.
All the best,
Radoslav
the Telerik team
Do you want to have your say when we set our development plans?
Do you want to know when a feature you care about is added or when a bug fixed?
Explore the
Telerik Public Issue Tracking
system and vote to affect the priority of the items
0
Carlos
Top achievements
Rank 1
answered on 26 Oct 2010, 05:04 PM
That is doing the job, thxnks alot... not i got another problen, i cant get to work a delete buttom on the radgrid
This is working so far, could you plz help me.
I just need to add a button to delete each temp rows from my grid...
Thanks alot
<telerik:RadGrid ID="rgotros" runat="server" AutoGenerateColumns="False" GridLines="None"> <ClientSettings> <Selecting AllowRowSelect="True" /> </ClientSettings> <MasterTableView> <CommandItemSettings ExportToPdfText="Export to Pdf"></CommandItemSettings> <Columns> <telerik:GridBoundColumn DataField="txtnombre" UniqueName="txtnombre" HeaderText=""> </telerik:GridBoundColumn> <telerik:GridTemplateColumn UniqueName="temprespseg" HeaderText="RESPSEG" > <ItemTemplate> <asp:CheckBox ID="chkrespseg" runat="server"/> </ItemTemplate> </telerik:GridTemplateColumn> <telerik:GridTemplateColumn UniqueName="tempatender" HeaderText="ATENDER" > <ItemTemplate> <asp:CheckBox ID="chkatender" runat="server" /> </ItemTemplate> </telerik:GridTemplateColumn> <telerik:GridTemplateColumn UniqueName="tempcomentar" HeaderText="COMENTAR" > <ItemTemplate> <asp:CheckBox ID="chkcomentar" runat="server" /> </ItemTemplate> </telerik:GridTemplateColumn> <telerik:GridTemplateColumn UniqueName="tempenterar" HeaderText="ENTERAR" > <ItemTemplate> <asp:CheckBox ID="chkenterar" runat="server" /> </ItemTemplate> </telerik:GridTemplateColumn> <telerik:GridTemplateColumn UniqueName="temparchivar" HeaderText="ARCHIVAR" > <ItemTemplate> <asp:CheckBox ID="chkarchivar" runat="server" /> </ItemTemplate> </telerik:GridTemplateColumn> </Columns> </MasterTableView> </telerik:RadGrid>Public Property MyDataTable() As DataTable Get If Session("MyDataTable") Is Nothing Then Session("MyDataTable") = New DataTable() End If Return CType(Session("MyDataTable"), DataTable) End Get Set(ByVal Value As DataTable) Session("MyDataTable") = Value End Set End Property Protected Sub RadGrid1_NeedDataSource(ByVal sender As Object, ByVal e As Telerik.Web.UI.GridNeedDataSourceEventArgs) Handles rgotros.NeedDataSource rgotros.DataSource = MyDataTable End Sub Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnotro.Click If MyDataTable.Columns.Count = 0 Then MyDataTable.Columns.Add("txtnombre") End If Dim selectedvalue As String = rcbotros.SelectedItem.Text MyDataTable.Rows.Add(selectedvalue) rgotros.Rebind() End SubThis is working so far, could you plz help me.
I just need to add a button to delete each temp rows from my grid...
Thanks alot
0
Hi Carlos,
I am sending you the modified example. Please check it out and let me know if it helps you.
Sincerely yours,
Radoslav
the Telerik team
I am sending you the modified example. Please check it out and let me know if it helps you.
Sincerely yours,
Radoslav
the Telerik team
Do you want to have your say when we set our development plans?
Do you want to know when a feature you care about is added or when a bug fixed?
Explore the
Telerik Public Issue Tracking
system and vote to affect the priority of the items
0
Carlos
Top achievements
Rank 1
answered on 27 Oct 2010, 04:40 PM
Worked perfectly
Thanks alot Radoslav
Thanks alot Radoslav
