This is a migrated thread and some comments may be shown as answers.

Set Template Control Values from Outside of Grid

2 Answers 95 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Marcus
Top achievements
Rank 1
Marcus asked on 22 Sep 2011, 01:08 PM
Within my project I have a Radgrid to collect a customers address. On Insert Mode a button appears by the postcode textbox which loads a RadWindow with a selection of addresses for the given postcode. I collect the value from the textbox with the following code:-

Protected Sub RadGrid1_ItemCommand(sender As Object, e As Telerik.Web.UI.GridCommandEventArgs) Handles RadGrid1.ItemCommand
 
          Select Case e.CommandName
            Case "getValue"
 
                Dim rg_control As RadButton = TryCast(sender, RadButton)
 
                rg_control = DirectCast(e.CommandSource, RadButton)
 
                Dim postcode As String = DirectCast(rg_control.NamingContainer.FindControl("PostalCodeTextBox"), TextBox).Text()
 
                                             'LOAD RAD WINDOW
                      rw_findPostcode.VisibleOnPageLoad = True

           End Select
 
End Sub

Obviously the above is fine for collecting the value entered. Ok now the problem.

Within the RadWindow I have a RadListBox which displays the list of available addresses. On selection a selectedIndexChanged Event fires and returns the selected row. How do I fill the template within the RadGrid with the selected values.

Any ideas?

Marcus


2 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 22 Sep 2011, 01:36 PM
Hello Marcus,

You can try the following demo approach to achieve your scenario.
Controls / Window Editing.

Thanks,
Princy.
0
Marcus
Top achievements
Rank 1
answered on 22 Sep 2011, 02:08 PM
Hi Princy - As ever thanx for your quick reply,

The problem I have is that the selected address from the RadWindow needs to display in the RadGrid while in Edit Mode...

If I try and make my request more simple:-

Say I have a RadGrid and it displays in edit/insert mode. Also I have a button OUTSIDE the grid. If I click the button how do I enter something into the Edit Template textboxes? If I was using the ItemCommand I would use:-

Dim rg_control As RadButton = TryCast(sender, RadButton)
 
rg_control = DirectCast(e.CommandSource, RadButton)
 
DirectCast(rg_control.NamingContainer.FindControl("PostalCodeTextBox"), TextBox).Text() = "It Worked!!!"

How therefore do I do the same as above but from a Click Event generated from a button outside the grid.

Thanx for your help,

Marcus
Tags
Grid
Asked by
Marcus
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Marcus
Top achievements
Rank 1
Share this question
or