D Patel
asked on
ASP.NET : GridView > telerik:RadNumericTextbox > on text change & lost focus event > Update value to database
ASKER
Ok
ASKER
.ASPX :
<asp:GridView ID="GridView1" runat="server" class="display" AutoGenerateColumns="False" DataKeyNames="prefLine"
HeaderStyle-BackColor="#3AC0F2" HeaderStyle-ForeColor="White" AllowPaging="false" AllowSorting="True"
OnPageIndexChanging="GridView1_PageIndexChanging" BorderStyle="None" BorderWidth="1px" CssClass="bgtable" Width="100%" BackColor="White" BorderColor="#999999" CellPadding="3" EnableModelValidation="True" GridLines="Both">
<RowStyle BackColor="#EEEEEE" ForeColor="Black" />
<Columns>
<asp:TemplateField HeaderText="Edit" >
<ItemTemplate>
<asp:HyperLink ID="HyperLink1" runat="server" NavigateUrl='<%#String.Format("fmSales.aspx?id={0}&det={1}", HttpUtility.UrlEncode(Eval("nSalesID").ToString()), HttpUtility.UrlEncode(Eval("nSalesDetID").ToString())) %>'
Text="Edit" CommandName="select">
</asp:HyperLink>
</ItemTemplate>
</asp:TemplateField>
<asp:BoundField DataField="nSalesDetID" HeaderText="Location" Visible="false">
<HeaderStyle HorizontalAlign="Center" />
<ItemStyle HorizontalAlign="Center" />
</asp:BoundField>
<asp:TemplateField HeaderText="Position" Visible="false">
<ItemTemplate>
<asp:Label ID="lblRowNumber" Text='<%# Container.DataItemIndex + 1 %>' runat="server" />
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="PO LINE">
<ItemTemplate>
<telerik:RadNumericTextBox ID="txtSwapTo" Runat="server" Width="30px" NumberFormat-DecimalDigits="0" MinValue="0" Value='<%#Eval("prefLine") %>' IncrementSettings-InterceptArrowKeys="False" IncrementSettings-InterceptMouseWheel="False" />
</ItemTemplate>
</asp:TemplateField>
<asp:BoundField DataField="sOrderNo" HeaderText="Customer PO">
<HeaderStyle HorizontalAlign="Center" />
<ItemStyle HorizontalAlign="Center" />
</asp:BoundField>
<asp:TemplateField FooterStyle-HorizontalAlign="Center">
<HeaderTemplate>
<input id="Checkbox1" onclick="checkUncheckAll(this);" type="checkbox"/>
</HeaderTemplate>
<ItemTemplate>
<asp:CheckBox ID="CheckBoxID" runat="server"/>
</ItemTemplate>
<FooterStyle HorizontalAlign="Center" />
</asp:TemplateField>
</Columns>
<FooterStyle BackColor="#CCCCCC" ForeColor="Black" />
<PagerStyle BackColor="#999999" ForeColor="Black" HorizontalAlign="Center" />
<SelectedRowStyle BackColor="#008A8C" Font-Bold="True" ForeColor="White" />
<HeaderStyle BackColor="#000084" Font-Bold="True" ForeColor="White" BorderColor="Black" BorderStyle="Solid" VerticalAlign="Middle" />
<AlternatingRowStyle BackColor="#DCDCDC" />
<PagerSettings Position="TopAndBottom" />
</asp:GridView>
ASKER
.aspx.vb Code :
Public Sub fillgridExport(ByVal conn As OdbcConnection)
Dim sql1 As String = ""
sql1 += "SELECT tsalesdet.prefLine, tsalesdet.nSalesDetID, @s:=@s+1 srno, tsalesdet.sOrderNo, tsalesdet.nSalesID"
sql1 += " FROM (tsalesdet, (SELECT @s:= 0) AS s)"
sql1 += " where tsalesdet.nSalesID=" & Request.QueryString("id") & " order by prefLine"
FillGrid(GridView1, sql1, conn)
End Sub
Public Sub FillGrid(ByVal vGrd As GridView, ByVal sql As String, ByVal conn As OdbcConnection)
Dim dsDataset As New DataSet()
Dim daAdapter As New OdbcDataAdapter()
daAdapter.SelectCommand = New OdbcCommand(sql, conn)
daAdapter.SelectCommand.CommandTimeout = 360
daAdapter.MissingSchemaAction = MissingSchemaAction.AddWithKey
daAdapter.Fill(dsDataset)
If dsDataset IsNot Nothing Then
If dsDataset.Tables.Count > 0 Then
If dsDataset.Tables(0).Rows.Count > 0 Then
vGrd.DataSource = dsDataset
vGrd.DataBind()
End If
End If
End If
daAdapter.Dispose()
dsDataset.Dispose()
End Sub
Protected Sub GridView1_PageIndexChanging(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewPageEventArgs) Handles GridView1.PageIndexChanging
Dim connGV = conobj.makeConnection
GridView1.PageIndex = e.NewPageIndex
If Request.QueryString("id") <> "" Then
fillgridExport(conn)
End If
connGV.Close()
End Sub
ASKER
nSalesDetID is the primary key field
and prefLine is the Preference that I will input into Textbox at RadGrid.
I want to update the database when preference is input through textbox
and prefLine is the Preference that I will input into Textbox at RadGrid.
I want to update the database when preference is input through textbox
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thank Hainkurt,
The link which you have shared helped me to resolve the issue.
Regards,
D Patel
The link which you have shared helped me to resolve the issue.
Regards,
D Patel
aspx + code behind that updates the database...