Public Sub btnsave_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnsave.Click AddG() End Sub Public Sub AddG() For Each item As GridDataItem In GD_Prod.Items Dim tx3 As TextBox = DirectCast(item("PL_STUDENT_Portions_Planned").FindControl("TxtSTUPort"), TextBox) Dim str3 As Object = tx3.text If tx3.Text = Nothing Then str3 = DBNull.Value ElseIf IsNumeric(tx3.Text) Then str3 = Val(tx3.Text) End If Dim con As New SqlConnection(ConfigurationManager.ConnectionStrings("FConnectionString").ConnectionString) Dim cmd As New SqlCommand("P_FN_PR_InsertGridData", con) cmd.CommandType = CommandType.StoredProcedure cmd.Parameters.Add("@PL_Student_Portions_Planned", System.Data.SqlDbType.VarChar) cmd.Parameters("@PL_Student_Portions_Planned").Value = str3 con.Open() cmd.ExecuteNonQuery() con.Close() Next End Sub
<telerik:RadGrid ID="GD_Prod" runat="server" AllowPaging="True" ShowHeader="False" AutoGenerateColumns="False" GridLines="None" Height="173px" Skin="Outlook" Width="1107px" PageSize="1"> <MasterTableView> <Columns> <telerik:GridTemplateColumn UniqueName="PL_STUDENT_Portions_Planned" > <ItemTemplate> <asp:TextBox ID="TxtSTUPort" runat="server" Height="16px" Width="30px" ></asp:TextBox> <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ControlToValidate="TxtSTUPort" ErrorMessage="*" ForeColor="#CC3300" SetFocusOnError="True" Display="Dynamic"></asp:RequiredFieldValidator> <asp:RegularExpressionValidator ID="RegularExpressionValidator1" runat="server" ControlToValidate="TxtSTUPort" ErrorMessage="Number" ForeColor="#CC3300" SetFocusOnError="True" ValidationExpression="[0-9]*" Display="Dynamic" Font-Size="6px"></asp:RegularExpressionValidator> </ItemTemplate> <HeaderStyle Width="19px" /> </telerik:GridTemplateColumn> </Columns> </telerik:RadGrid> <asp:Button ID="btnsave" runat="server" Height="20px" Text="SAVE" Width="50px" ToolTip="Click to Save " BackColor="#DFEFFF" ForeColor="#003399" />
ALTER PROCEDURE [DBO].P_FN_PR_InsertGridData ( @PL_Student_Portions_Planned varchar(10) = 0 ) AS begin INSERT INTO FNProdRecDetails (PL_Student_Portions_Planned) values(@PL_Student_Portions_Planned) End Return
IsPostback
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)