How to open edit form WebUserControl using link button outside the grid

5 posts, 1 answers
  1. ELBU
    ELBU avatar
    13 posts
    Member since:
    Nov 2008

    Posted 19 Nov 2008 Link to this post

    Hello,

    I'll appreciate you help, since I'm trying to perform this action for a couple of hours without success.

    I have a button , let's call it "ADD NEW ROW IN GRID"
    Additionally , I have 3 link buttons placed on top of grid : add new record  , update record,  delete record

    for some reason I need my WebUserControl form to be opened not from the link of the grid itself, but using
    the button  "ADD NEW ROW IN GRID"

    I tried to make ON CLICK event and from it I call another event  

     

    protected void btnAddNewRow_OnClick(object sender, ImageClickEventArgs e)

     

    {

     

           if (Page.IsValid)

     

     

                this.btnAdd_OnClick(sender, e);

     

    }
    I get an error in this case.....
    What am I missing ?

    When I press the link on the grid itself , it works just fine , so what is the difference ?

  2. Answer
    Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 20 Nov 2008 Link to this post

    Hello ELBU,

    From what I understand, i suppose you want to open an insert form in the grid on clicking a button outside the grid. If this is the case then try out the following to achieve the same :
    aspx:
    <asp:Button ID="btnAddNewRow" runat="server" Text="AddNewRowButton" OnClick="btnAddNewRow_Click" />    

    cs:
     protected void btnAddNewRow_Click(object sender, EventArgs e) 
        { 
            RadGrid1.MasterTableView.IsItemInserted = true
            RadGrid1.Rebind(); 
        } 

    Thanks
    Princy.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. ELBU
    ELBU avatar
    13 posts
    Member since:
    Nov 2008

    Posted 20 Nov 2008 Link to this post

    Thanks a lot !!!
  5. Bibek
    Bibek avatar
    7 posts
    Member since:
    Dec 2008

    Posted 06 Jan 2009 Link to this post

    The code is helpful for me as well. But how can we edit the particular row in the same way. What I want is: user will select the row and click the button outside the gridview to edit that row.

    Thanks in advance
  6. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 06 Jan 2009 Link to this post

    Hi Bibek,

    Try out the following code snippet to achieve the desired scenario.

    CS:
      protected void LinkButton1_Click(object sender, EventArgs e) 
        { 
            foreach (GridDataItem item in RadGrid1.SelectedItems) 
            { 
                item.Edit = true
            } 
            RadGrid1.Rebind(); 
        } 


    Thanks
    Shinu.
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017