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

Rad grid EditFormSettings

4 Answers 288 Views
Grid
This is a migrated thread and some comments may be shown as answers.
dony
Top achievements
Rank 1
dony asked on 15 Jan 2009, 10:14 AM
Hi,
I have one user control, say test.ascx, I am refering this user control in 2 aspx pages. In one aspx page, i am calling this user control inside the rad grid EditFormSetting tag.
In this case can I identify from the code behind wether this user control is calling inside the Editform setting tag or not ?

4 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 15 Jan 2009, 11:21 AM
Hello Dony,

I'm not sure of what is your requirement but i suppose you are trying to access the UserControlEditForm. If that is the case, check out the code given below:
cs:
protected void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e) 
    { 
       if (e.Item is GridEditFormItem && e.Item.IsInEditMode) 
        { 
            GridEditFormItem editedItem = e.Item as GridEditFormItem; 
            UserControl userControl = (UserControl)editedItem.FindControl(GridEditFormItem.EditFormUserControlID); 
         
        } 
    } 

Thanks
Princy
0
dony
Top achievements
Rank 1
answered on 15 Jan 2009, 11:52 AM
Hi Princy,
Actually i need to identify in the user control itself, like if that user control is currently coming under an EditFormSetting or not.
Regards,
Dony Jose Augustine
0
Srinivasaragavan
Top achievements
Rank 1
answered on 27 Nov 2012, 01:13 PM
Hi
I have a grid that uses a User control for Add/Edit. which is similar to the one given in (http://demos.telerik.com/aspnet-ajax/grid/examples/dataediting/usercontroleditform/defaultcs.aspx)
I have used similar Edit form. 

When i click on the Edit form, the (InsertCommand) event is getting executed. But i'm not able to retrieve the text of the textbox available inside. To my understanding, the edit form(user control) is getting post back and it becomes empty.

Please help me in this issue.
I need to retain the values on click of insert button. 

Thanks
Srinivas
0
Eyup
Telerik team
answered on 30 Nov 2012, 11:49 AM
Hello Srinivas,

You could access the generated control using the approach demonstrated in the following article:
( Section Accessing controls in edit/insert mode )
http://www.telerik.com/help/aspnet-ajax/grid-accessing-cells-and-rows.html

You could also determine whether the opened form is Edit or Insert form:
http://www.telerik.com/help/aspnet-ajax/grid-distinguish-edit-insert-mode-on-itemcreated-itemdatabound.html

In your case you could use ItemCommand server event adding the condition (e.CommandName == RadGrid.PerformInsertCommandName) or InsertCommand server event.

I hope this will prove helpful. Please give it a try and let me know about the result.

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
dony
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
dony
Top achievements
Rank 1
Srinivasaragavan
Top achievements
Rank 1
Eyup
Telerik team
Share this question
or