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

postback in usercontrol

2 Answers 109 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
mww
Top achievements
Rank 1
mww asked on 28 Oct 2008, 07:02 PM
I have a usercontrol with a text box and RADGrid.  Users can enter a search phrase in the text box, hitting a search button populates the grid with the results.
I want the user to be able to select a particular row (and its underlying datakey value) and force a postback to the page the control is in.  Then in the page, use the datakey value to query the database and populate the page with the results.

Im not 100% sure how do go about this.  Can I setup some javascript on each row in the grid, then when a row is selected use something like RadGrid1.AjaxRequest()   or would I have to use __doPostBack somewhere ?

any help would be greatly appreciated

2 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 29 Oct 2008, 01:35 PM
Hello Mark,

To enable postback on clicking a row in a grid you can set the EnablePoastBackOnRowClick for the grid to true as shown below and then access the datakeyvalue for the grid :
       <telerik:RadGrid ID="RadGrid2" runat="server" >             
        <MasterTableView>                     
        </MasterTableView>         
        <ClientSettings  EnablePostBackOnRowClick="True">  
        </ClientSettings> 
        </telerik:RadGrid> 

Thanks
Princy.

0
mww
Top achievements
Rank 1
answered on 29 Oct 2008, 03:45 PM
how would I be able to get the datakey value ?
By setting EnablePostbackOnRow click to true, when I check the contents of 

__EVENTTARGET  I get 

"ctl00$ContentPlaceHolder1$ctl01$SearchByArtist1$RadGridArtistName$ctl00$ctl04$ctl00"

and in 

 

__EVENTARGUMENT

I get
RowClick;0"

the datakey for each row is a guid

Tags
ComboBox
Asked by
mww
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
mww
Top achievements
Rank 1
Share this question
or