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

Show blank RadGrid

5 Answers 123 Views
Grid
This is a migrated thread and some comments may be shown as answers.
shivesh
Top achievements
Rank 1
shivesh asked on 03 Nov 2010, 08:28 AM
hi,
do't confuse above title actually i have resolve my problem.
my new problem is that how can i create new row after filling first row by user.
actully when user click add button grid display with single row after first row how can i generate new row in grid view as first row.
Thanks

5 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 03 Nov 2010, 10:33 AM
Hello Shivesh,

If you are performing automatic insertion, adding the following code in ItemInserted event will help you to remain the insertform opened, even after clicking "Insert" button.
C#:
protected void RadGrid1_ItemInserted(object source, GridInsertedEventArgs e)
{
     e.KeepInInsertMode = true;
}

Otherwise try the following code snippet.
C#:
bool isinsert = false;
protected void RadGrid1_InsertCommand(object source, GridCommandEventArgs e)
{
    isinsert = true;
}
protected void RadGrid1_PreRender(object sender, EventArgs e)
{
  if (isinsert)
    {
        isinsert = false;
        RadGrid1.MasterTableView.IsItemInserted = true;
        RadGrid1.MasterTableView.Rebind();
    }
 }

Thanks,
Princy.
0
shivesh
Top achievements
Rank 1
answered on 03 Nov 2010, 11:00 AM
thanks but
i am not understand your logic i am using oniteminserted and i have also used yr code.
how this event fire.
0
Princy
Top achievements
Rank 2
answered on 03 Nov 2010, 12:35 PM
Hello Shivesh,

                        I guess you want to show new insertform after inserting an item.

The ItemUpdated, ItemInserted and ItemDeleted events fires only when using automatic operations in grid. If you are manually updating the record, then the second option in the previous reply will be helpful. The code is for setting a flag in InsertCommand event and opening the insertform in PreRender based on the flag.

Hope this suggestion helps.


Thanks,
Princy.
0
shivesh
Top achievements
Rank 1
answered on 04 Nov 2010, 07:23 AM
Hi,
Princy I want to inline insert data in new row.
my grid using for order there are user make one order at a time so
i want no of rows generate one by one as per user requirement.
i am able to show balnk grid and then able to generate first row by click of add button that are outside from grid now want to add new rows for next items.

i am not able to do that.
plz help.
thanks
0
Maria Ilieva
Telerik team
answered on 09 Nov 2010, 04:53 PM
Hi shivesh,

You could use a ContextMenu to provide this functionality. For example:

 ASPX:
<NoRecordsTemplate
    <asp:Label ID="Label1" runat="server" Text="No records to display"></asp:Label
</NoRecordsTemplate>

CS:
protected void RadGrid1_ItemCreated(object sender, GridItemEventArgs e) 
    if (e.Item is GridNoRecordsItem) 
    
        Label lbl = (e.Item as GridNoRecordsItem).FindControl("Label1") as Label; 
        ContextMenuElementTarget target = new ContextMenuElementTarget(); 
        target.ElementID = lbl.ClientID; 
        RadMenu1.Targets.Add(target); 
    
}


Regards,
Maria Ilieva
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
Grid
Asked by
shivesh
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
shivesh
Top achievements
Rank 1
Maria Ilieva
Telerik team
Share this question
or