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

[Solved] Which event for "Add new record"?

4 Answers 233 Views
Grid
This is a migrated thread and some comments may be shown as answers.
scrut
Top achievements
Rank 1
scrut asked on 31 May 2008, 04:46 PM
Right now I have a RadGrid with its MasterTableView's "CommandItemDisplay="Top"" configured.

This setting shows a "Add new record" control above the Grid and allows inserting a new item.

But I don't want this control to be shown. Instead, I want to use a regular button somewhere else on the ASP page. When pressed, the Grid should behave just like it would be upon clicking the "Add new record" button.

Which event does the Button have to trigger in the RadGrid in order for this behaviour to show?

Thanks

s.

4 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 02 Jun 2008, 07:00 AM
Hi Scrut,

Try the following code snippet to achieve the desired scenario.

ASPX:
    <asp:Button ID="Button1" runat="server" OnClick="Button1_Click" Text="Button" /> 


CS:
protected void Button1_Click(object sender, EventArgs e)  
    {  
        RadGrid1.MasterTableView.IsItemInserted = true;  
     } 


Thanks
Princy.
0
scrut
Top achievements
Rank 1
answered on 02 Jun 2008, 12:46 PM
Thanks for your very helpful reply.
However, the desired effect only occurs after clicking that button twice.
(I use Prometheus 415 - in case that makes a difference)
0
scrut
Top achievements
Rank 1
answered on 02 Jun 2008, 12:59 PM

Oh, and for some reason, the 

GridDropDownColumns I use remain empty when I do it this way.

If I use CommandItemDisplay="Top" in  MasterTableView, everything works fine

0
Iana Tsolova
Telerik team
answered on 02 Jun 2008, 01:16 PM
Hello scrut,

You need to rebind the grid in order the new settings to take effect:

protected void Button1_Click(object sender, EventArgs e)  
{  
    RadGrid1.MasterTableView.IsItemInserted = true;  
    RadGrid1.Rebind();  

Let us know if we could help you further.

Greetings,
Iana
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
Tags
Grid
Asked by
scrut
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
scrut
Top achievements
Rank 1
Iana Tsolova
Telerik team
Share this question
or