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

How to call Grid Add new record image button on server side code

2 Answers 52 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Manickam Kishore
Top achievements
Rank 2
Manickam Kishore asked on 10 Oct 2008, 10:45 AM
Hi,

I want to call RadGrid [add new record] image button on server side coding. If i click a button(lies out side of the radgrid)  then i need to call RadGrid [add new record] image button.

Regards,
Kishore

2 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 10 Oct 2008, 11:06 AM
Hello Kishore,

You can try out the following code to access the AddNewRecord image button in the click event of a button.
cs:
protected void Button1_Click(object sender, EventArgs e) 
    { 
       foreach (GridCommandItem item in RadGrid1.MasterTableView.GetItems(GridItemType.CommandItem)) 
        { 
           Button btn = (Button)item.FindControl("AddNewRecordButton");           
        } 
    } 

Thanks
Princy.
0
Manickam Kishore
Top achievements
Rank 2
answered on 10 Oct 2008, 11:34 AM
Hi princy,

I tried what u were suggested but I can not get the Grid AddnewRecord image button object from my grid. one way i solved this problem but i dont know which is work all browser .

This is the code used:

protected void Button1_Click(object sender, EventArgs e) 
{
    RManager.ResponseScripts.Add("__doPostBack('ctl00$ContentPlaceHolder1$RadGrid1$ctl00$ctl03$ctl01$InitInsertButton','');return false;");
}


Thanks,
Kishore
Tags
Grid
Asked by
Manickam Kishore
Top achievements
Rank 2
Answers by
Princy
Top achievements
Rank 2
Manickam Kishore
Top achievements
Rank 2
Share this question
or