I have a radgrid with a Textbox inside a telerik:GridTemplateColumn
<telerik:GridTemplateColumn HeaderText="<%$ Resources:Language, lbl_rg_nota %>" UniqueName="Nota" AllowFiltering="false" ReadOnly="true">
<ItemTemplate>
<asp:Textbox ID="txtNota" runat="server" CssClass="form-control form-control-sm" ></asp:Textbox>
</ItemTemplate>
</telerik:GridTemplateColumn>
I want to get access to the values the user writes in the textboxes after they click the save button, this is the code behind the button
protected void btnLevantaPeticion_OnClick(object sender, EventArgs e)
{
try
{
var dtHtasSeleccionadas = (Session["dtHtasSeleccionadas"] != null) ? (DataTable)Session["dtHtasSeleccionadas"] : new DataTable();
var Folio = CDatos.SP_PeticionesAlmacen.SP_MaxFolio();
foreach (GridDataItem item in rgHerramientas.MasterTableView.Items)
{
TextBox txtNota = item.FindControl("txtNota") as TextBox;
ShowMessage(txtNota.ToString(), "success");
}
DataTable dt = (DataTable)Session["dtHtasSeleccionadas"];
foreach(DataRow dr in dt.Rows)
{
//dtHtasSeleccionadas.Columns.Add("IdHerramienta");
//dtHtasSeleccionadas.Columns.Add("Codigo");
//dtHtasSeleccionadas.Columns.Add("NombreCorto");
//dtHtasSeleccionadas.Columns.Add("Cantidad");
//dtHtasSeleccionadas.Columns.Add("Costo", typeof(double));
//dtHtasSeleccionadas.Columns.Add("Gasto", typeof(double));
//dtHtasSeleccionadas.Columns.Add("Nota");
for (int i = 0; i< int.Parse(dr.ItemArray[4].ToString()); i++)
{
var id2 = CDatos.DDetalles.InsertDetallePeticiones(int.Parse(Folio.ToString()),int.Parse(dr.ItemArray[0].ToString()),1,decimal.Parse(dr.ItemArray[5].ToString()),1,"");
}
}
this.ShowMessage(Resources.Language.mess_peticion, "success");
}
catch (Exception ex) { this.ShowMessage(ex.Message, "danger"); }
}
I want to be able to save the data from the textboxes as the last paramenter of the InsertCommand, instead of the ""