i am trying to retrieving data from database into gridview by searching from textbox.
it just call orderno, other column item name and qty are not coming gridview.
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Customerorder.aspx.cs" Inherits="Saleorder.Customerorder" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
<table class="auto-style1">
<tr>
<td class="auto-style2"> </td>
<td class="auto-style3"> </td>
<td>
<h1>Customer Order Form</h1>
</td>
</tr>
<tr>
<td class="auto-style2">OrderNo</td>
<td class="auto-style3">
<asp:TextBox ID="txtSID" runat="server"></asp:TextBox>
</td>
<td>Date :
<asp:TextBox ID="txtsdate" runat="server" TextMode="DateTime"></asp:TextBox>
Search Order:
<asp:TextBox ID="txtsearchso" runat="server" OnTextChanged="txtsearchso_TextChanged" AutoPostBack="true"></asp:TextBox>
</td>
</tr>
<tr>
<td class="auto-style4">Customer Name:</td>
<td class="auto-style5">
<asp:DropDownList ID="DDSCID" runat="server">
</asp:DropDownList>
</td>
<td class="auto-style6">Ref_No :
<asp:TextBox ID="txtsrefID" runat="server"></asp:TextBox>
</td>
</tr>
<tr>
<td class="auto-style2">Status : </td>
<td class="auto-style3">
<asp:DropDownList ID="DDLStatus" runat="server">
<asp:ListItem Value="Open" >Open</asp:ListItem>
<asp:ListItem Value="Close">Close</asp:ListItem>
</asp:DropDownList>
</td>
<td> </td>
</tr>
</table>
</div>
<table class="auto-style1">
<tr>
<asp:GridView ID="Gridview1" runat="server" ShowFooter="true" AutoGenerateColumns="false"
OnRowCreated="Gridview1_RowCreated" OnRowDataBound="Gridview1_RowDataBound">
<Columns>
<%--<asp:BoundField DataField="RowNumber" HeaderText="Row Number" />--%>
<asp:TemplateField HeaderText="OrderID">
<ItemTemplate>
<asp:TextBox ID="txtIDGV" runat="server" Text='<%# Eval("OrderNo") %>'></asp:TextBox>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText = "Item_Name">
<ItemTemplate>
<asp:Label ID="lblitemcode" runat="server" Text='<%# Eval("Descriptionitem") %>' Visible = "false" />
<asp:DropDownList ID="ddlitemcode" runat="server" AutoPostBack="True"
onselectedindexchanged="ddlitemcode_SelectedIndexChanged1" Width="150px">
</asp:DropDownList>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Order_Qty">
<ItemTemplate>
<asp:Textbox ID="txtqty" runat="server" ></asp:Textbox>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Weight">
<ItemTemplate>
<asp:TextBox ID="txtweigth" runat="server" ></asp:TextBox>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Bale_Size">
<ItemTemplate>
<asp:TextBox ID="txtbs" runat="server"></asp:TextBox>
</ItemTemplate>
<FooterStyle HorizontalAlign="Right" />
<FooterTemplate>
<asp:Button ID="ButtonAdd" runat="server" Text="Add New Row" OnClick="ButtonAdd_Click" />
</FooterTemplate>
</asp:TemplateField>
<asp:TemplateField>
<ItemTemplate>
<asp:LinkButton ID="LinkButton1" runat="server" OnClick="LinkButton1_Click">Remove</asp:LinkButton>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
<asp:Button ID="Button1" runat="server" OnClick="Button1_Click" style="height: 26px" Text="Save" />
</table>
</form>
</body>
</html>
C#
code on textbox for retriving data
protected void txtsearchso_TextChanged(object sender, EventArgs e)
{
{
SqlConnection con = new SqlConnection("Data Source=DESKTOP-5PJ76B9;Integrated Security=SSPI;Initial Catalog=SilverProduction;MultipleActiveResultSets=True;");
SqlCommand cmdbnoss = new SqlCommand("searchbyorderno", con);
cmdbnoss.CommandType = CommandType.StoredProcedure;
cmdbnoss.Parameters.AddWithValue("OrderNo", txtsearchso.Text);
SqlDataAdapter adptbnoss = new SqlDataAdapter(cmdbnoss);
DataTable dtbnoss = new DataTable();
adptbnoss.Fill(dtbnoss);
Gridview1.DataSource = dtbnoss;
Gridview1.DataBind();
cmdbnoss.Dispose();
con.Close();
}
please help..