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

Problem In RadGrid

3 Answers 66 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Harees
Top achievements
Rank 1
Harees asked on 08 Oct 2012, 02:04 PM
Hi!!!

I Will explain this with your demo http://demos.telerik.com/aspnet-ajax/grid/examples/dataediting/validation/defaultcs.aspx
in this,
1.click on the add new record button.(don't close and don't enter any values)
2.After that edit any one of the items in the Grid.
3.try to update the edited item.
here it will not update that row,instead it will show the " required field " for the add new record template.

this is my problem,how to overcome from this ......

I want to close the add new template form ,when we clicked on edit button.

please help me i am new to rad controls....

thanks...

3 Answers, 1 is accepted

Sort by
0
Accepted
Shinu
Top achievements
Rank 2
answered on 09 Oct 2012, 04:21 AM
Hi,

Please try the following code snippet to hide editform when insert form is showing and vice versa.

C#:
protected void RadGrid1_ItemCommand(object source, GridCommandEventArgs e) 
   if (e.CommandName == RadGrid.EditCommandName) 
   
      RadGrid1.MasterTableView.IsItemInserted = false
   
   if (e.CommandName == RadGrid.InitInsertCommandName) 
   
      RadGrid1.MasterTableView.ClearEditItems(); 
   
}

Thanks,
Shinu.
0
Harees
Top achievements
Rank 1
answered on 09 Oct 2012, 06:19 AM

Thanks Shinu......

But i want to use it on ItemDataBound event....

If possible how can we get the command name property in griditemeventargs .....


thanks.
0
Accepted
Eyup
Telerik team
answered on 10 Oct 2012, 01:02 PM
Hi Harees,

You could pass the command name using a global variable:
string commandName = String.Empty;
protected void RadGrid1_ItemCommand(object sender, GridCommandEventArgs e)
{
    commandName = e.CommandName;
}
protected void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e)
{
    // execute custom logic using commandName
}

I hope this will prove helpful.

Greetings,
Eyup
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Tags
Grid
Asked by
Harees
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Harees
Top achievements
Rank 1
Eyup
Telerik team
Share this question
or