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

radgrid_itemcreated add mode value not assign

2 Answers 73 Views
Grid
This is a migrated thread and some comments may be shown as answers.
mohamed
Top achievements
Rank 1
mohamed asked on 28 Sep 2011, 11:59 AM
Hello every one,

How to bind radtextbox in add mode in radgrid_itemcreated,
For Example, i have bind radcomobobox like that i want bind radtextbox, label ,
In bold are radtext i find like that all are come but not assign the values

.cs

protected void RadGrid1_ItemCreated(object sender, GridItemEventArgs e)
       {
           if (e.Item is GridEditFormItem && e.Item.IsInEditMode)
           {
               if (e.Item.OwnerTableView.IsItemInserted)
               {
                   GridEditFormItem item = (GridEditFormItem)e.Item;
                   RadComboBox RadComboBox_Mainwork = (RadComboBox)item.FindControl("RadComboBox_Mainwork");
                   RadComboBox RadCombo_SubWork = (RadComboBox)item.FindControl("RadCombo_SubWork");
                   RadTextBox projectcode = (RadTextBox)item.FindControl("projectcode");
                   Label projectcode1 = (Label)item.FindControl("projectcode1");
                   RadComboBox RadComboBox1 = (RadComboBox)item.FindControl("RadComboBox1");
 
                   using (var db = new DoskContractServicesDataContext(Globals.strCon))
                   {
                       var orgreqfinal = (from a in db.dsmainworks
                                          select new { a.maincode, a.mainname }).ToList();
                       RadComboBox_Mainwork.DataSource = orgreqfinal;
                       RadComboBox_Mainwork.DataValueField = "maincode";
                       RadComboBox_Mainwork.DataTextField = "mainname";
                       RadComboBox_Mainwork.Items.Insert(0, new RadComboBoxItem("Select Main Work", "-1"));
}
}
}


.aspx
<telerik:RadComboBox ID="RadComboBox_Mainwork" runat="server" Width="85%" DataValueField="maincode"
                                                            DataTextField="mainname" MaxLength="6" AppendDataBoundItems="true"></telerik:RadComboBox>




Thanks,
Mohamed.

2 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 28 Sep 2011, 02:25 PM
Hi Mohamed,

I didn't get your actual requirement.I suppose you need to set the radtextbox text with radgrid DataSource value. For that you can access the DataRowView of radgrid.

You can take a look into the following link.
Programmatically Create & Bind Data to RadNumericTextBox In RadGrid

Thanks,
Shinu.
0
mohamed
Top achievements
Rank 1
answered on 28 Sep 2011, 03:06 PM
Problem Solved,


If we bind in radgrid_itemcreated,
I mistake that text ='<%# Bind("ProjWorkid") %>'
That not put on it in the textbox,


Thanks,
Mohamed.
Tags
Grid
Asked by
mohamed
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
mohamed
Top achievements
Rank 1
Share this question
or