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

EDIT FORM in grid PLEASE HELP!!!

4 Answers 64 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Mike
Top achievements
Rank 1
Mike asked on 10 Jul 2008, 06:59 PM

Even with the Example below it does not show a REAL world way of binding the form data from codebehind with DataTables. 

This example does not tell me how to get the data
Example

I really need your assistance on this please show me what event is fired when clicking on the "Edit" link. 

Once the link is clicked, how does it query the data to fill the from?

4 Answers, 1 is accepted

Sort by
0
Vlad
Telerik team
answered on 11 Jul 2008, 05:54 AM
Hi George,

The example shows how to use automatic grid operations with DataSourceControl - you do not have to write code to do this. You can check old .NET 1.x style example if you do this manually:
http://demos1x.telerik.com/aspnet/Grid/Examples/DataEditing/TemplateFormUpdate/DefaultCS.aspx

The example is for our old "Classic" grid however the approach is the same in RadGrid for ASP.NET AJAX.

Best wishes,
Vlad
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Mike
Top achievements
Rank 1
answered on 11 Jul 2008, 12:25 PM

This is not working!!!!!!!!!!

It blows up and says!
An exception of type 'System.NullReferneceException' occurreed in App_Web_txmzbgl.dll but was not handeld in user code.

Additional information: Object reference not set to an instance of an object.

    protected void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e)  
    {  
        if (e.Item is GridDataItem)  
        {  
 
          PricingListBLL userObjectnew PricingListBLL();  
          RadComboBox userdata = (RadComboBox)e.Item.Cells[0].FindControl("RadComboBoxUsers");  
          userdata.DataSource = userObject.GetUsers;  
          userdata.DataTextField = "NAME";  
          userdata .DataValueField = "ID";  
          userdata .DataBind();  
        
        }  
    } 

aspx page
<EditFormSettings EditFormType="Template">  
     <FormTableItemStyle width="100%"></FormTableItemStyle> 
     <FormTableStyle GridLines="None" CellSpacing="0" CellPadding="2"></FormTableStyle> 
     <FormStyle Width="100%" backColor="white"></FormStyle> 
     <EditColumn UniqueName="EditCommandColumn1"></EditColumn> 
     <FormTemplate> 
         <telerik:RadComboBox ID="RadComboBoxUsers" Skin="Vista" runat="server" /> 
     </FormTemplate> 
</EditFormSettings> 


Can someone help please?
0
Mike
Top achievements
Rank 1
answered on 11 Jul 2008, 05:48 PM
Anyone out there?  I would really appreciate an assitance on this.

Thank you!
0
Vlad
Telerik team
answered on 14 Jul 2008, 04:47 AM
Hello George,

Can you try using the debugger to find a bit more info about the exception? I suspect that this line is throwing the error:
          RadComboBox userdata = (RadComboBox)e.Item.Cells[0].FindControl("RadComboBoxUsers"); 

You should use :

if (e.Item is GridDataItem && e.Item.IsInEditMode)

if you want to find a control when the item is in edit mode.

I'm not sure also about e.Item.Cells[0]. When you use form template you can simply do e.Item.FindControlI().

Sincerely yours,
Vlad
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
Tags
Grid
Asked by
Mike
Top achievements
Rank 1
Answers by
Vlad
Telerik team
Mike
Top achievements
Rank 1
Share this question
or