or
<tr> <td valign="top" align="left"> Route Name </td> <td> <telerik:RadComboBox ID="combo_routname" runat="server" Width="85%" DataValueField="routecode" DataTextField="routename" MaxLength="6" AutoPostBack="true"> </telerik:RadComboBox> </td> </tr> <tr> <td colspan="2" style="height: 5px;"> </td> </tr> <tr> <td valign="top" align="left"> Location </td> <td> <telerik:RadComboBox ID="RadCombo_Location" runat="server" Width="85%" MaxLength="6" DataValueField="locationcode" DataTextField="locationplan" > </telerik:RadComboBox> </td> </tr>protected void RadGrid1_ItemCreated(object sender, Telerik.Web.UI.GridItemEventArgs e) { if (e.Item is GridEditFormItem && e.Item.IsInEditMode) { if (e.Item.OwnerTableView.IsItemInserted) { GridEditFormItem item = (GridEditFormItem)e.Item; RadComboBox serviceprovname = (RadComboBox)item.FindControl("ComboBox_servprod"); RadComboBox routename = (RadComboBox)item.FindControl("combo_routname"); RadComboBox Location = (RadComboBox)item.FindControl("RadCombo_Location"); using (var db = new DoskContractServicesDataContext(Globals.strCon)) { var orgreqfinal = (from a in db.dsroutemasters where a.status != "DEL" select new { a.routecode, a.routename }).ToList(); routename.DataSource = orgreqfinal; routename.DataValueField = "routecode"; routename.DataTextField = "routename"; var datamaster = (from a in db.dsdatamasters where a.status != "DEL" && a.datatype == "serpro" select new { a.clientcode, a.clientname }).ToList(); serviceprovname.DataSource = datamaster; serviceprovname.DataValueField = "clientcode"; serviceprovname.DataTextField = "clientname"; if (routename.SelectedValue != "") { Location.Text = ""; Location.SelectedValue = ""; Location.ClearSelection(); Location.Items.Clear(); string LocationWise = ("select distinct locationcode, locationplan from dslocationmaster where status <> 'del' and routecode = '" + routename.SelectedValue + "' "); Location.DataSource = oDBClientADO.GetDataTable(LocationWise); Location.DataValueField = "locationcode"; Location.DataTextField = "locationplan"; Location.DataBind(); } else { string LocationWise = ("select distinct locationcode, locationplan from dslocationmaster where status <> 'del'"); Location.DataSource = oDBClientADO.GetDataTable(LocationWise); Location.DataValueField = "locationcode"; Location.DataTextField = "locationplan"; } } } else { GridEditFormItem item = (GridEditFormItem)e.Item; RadComboBox serviceprod = (RadComboBox)item.FindControl("ComboBox_servprod"); RadComboBox routename1 = (RadComboBox)item.FindControl("combo_routname"); RadComboBox Location = (RadComboBox)item.FindControl("RadCombo_Location"); using (var db = new DoskContractServicesDataContext(Globals.strCon)) { var orgreqfinal = (from a in db.dsroutemasters where a.status != "DEL" select new { a.routecode, a.routename }).ToList(); routename1.DataSource = orgreqfinal; routename1.DataValueField = "routecode"; routename1.DataTextField = "routename"; var datamaster = (from a in db.dsdatamasters where a.status != "DEL" && a.datatype == "serpro" select new { a.clientcode, a.clientname }).ToList(); serviceprod.DataSource = datamaster; serviceprod.DataValueField = "clientcode"; serviceprod.DataTextField = "clientname"; if (routename1.SelectedValue != "") { string LocationWise = ("select distinct locationcode, locationplan from dslocationmaster where status <> 'del' and routecode = '" + routename1.SelectedValue + "' "); Location.DataSource = oDBClientADO.GetDataTable(LocationWise); Location.DataValueField = "locationcode"; Location.DataTextField = "locationplan"; } else { string LocationWise = ("select distinct locationcode, locationplan from dslocationmaster where status <> 'del'"); Location.DataSource = oDBClientADO.GetDataTable(LocationWise); Location.DataValueField = "locationcode"; Location.DataTextField = "locationplan"; } } if (e.Item.IsInEditMode) { GridEditableItem editedItem = e.Item as GridEditableItem; GridEditFormItem editForm = (GridEditFormItem)e.Item; string serviceid = editForm["servprovcde"].Text; if (serviceid != " ") { SERVICEID1 = Convert.ToInt32(serviceid); if (SERVICEID1 > 0) { RadComboBox Servprd = (RadComboBox)item.FindControl("ComboBox_servprod"); RadComboBox Rutnam = (RadComboBox)item.FindControl("combo_routname"); RadComboBox lctn = (RadComboBox)item.FindControl("RadCombo_Location"); List<dsservicedeptnotify> service = DbClient.GetList<dsservicedeptnotify>("servprovcde = " + SERVICEID1); Servprd.SelectedValue = service[0].providercode.ToString(); Rutnam.SelectedValue = service[0].routecode.ToString(); lctn.SelectedValue = service[0].location.ToString(); } } } } } }
| function SetTotalCost2(sender, args) |
| { |
| var grid = $find('<%=gridBudget.ClientID %>'); |
| var MasterTable = grid.get_masterTableView(); |
| var Rows = MasterTable.get_dataItems(); |
| var textbox1 = Rows[1].findControl("txtCostPerUnit"); //which row no. to use to get add new row reference |
| var textbox2 = Rows[1].findControl("txtNoOfUnit"); |
| var textbox3 = Rows[1].findControl("txtTotalCost"); |
| textbox3.set_value(textbox1.get_value() * textbox2.get_value()); |
| } |
Could you please help. I don't know how to access row while adding a new record on client side.
Many thanks,
Sana Khurram