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

DataBind in the Web User Control Edit Form of the RadGrid

2 Answers 115 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Jamie
Top achievements
Rank 1
Jamie asked on 27 Aug 2010, 07:00 PM
I have setup a RadGrid and configured the EditFormType to WebUserControl, then I specified the user control that I want to use. I was wondering if there is a way to actually do the databinding inside the user control's .ascx file.

Here is what I have, that I took from an example:
<asp:TextBox ID="txtFirstName" 
                      runat="server"
                      Text='<%# DataBinder.Eval( Container, "DataItem.FirstName") %>' >
</asp:TextBox>

This will set my text appropriately when I click edit in the grid, but when I update it nothing is actually being bound because I haven't added any C# for it.

I want to know, if there is any way to do something like this (which I did using the FormTemplate EditFormSetting, and was able to bind the data without writing any extra code):
<asp:TextBox ID="txtFirstName" 
                      runat="server" 
                      Text='<%# Bind( "FirstName") %>'  >
</asp:TextBox>

So I can avoid writing the bind code in C# like the example I looked at.

2 Answers, 1 is accepted

Sort by
0
Accepted
Princy
Top achievements
Rank 2
answered on 30 Aug 2010, 12:26 PM
Hello,

I hope the following link will help you better.
Automatic DataSource operations


Thanks,
Princy.
0
Jamie
Top achievements
Rank 1
answered on 30 Aug 2010, 04:31 PM
Princy,

Thanks! That was extremely helpful, turns out all I was missing was linking my user control up to the IBindableControl interface. Works great now.


-Jamie
Tags
Grid
Asked by
Jamie
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Jamie
Top achievements
Rank 1
Share this question
or