postback in usercontrol

3 posts, 0 answers
  1. mww
    mww avatar
    257 posts
    Member since:
    Sep 2012

    Posted 28 Oct 2008 Link to this post

    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. Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 29 Oct 2008 Link to this post

    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.

  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. mww
    mww avatar
    257 posts
    Member since:
    Sep 2012

    Posted 29 Oct 2008 Link to this post

    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

Back to Top