Now i have a new one.
I want make a search according to category selected from the drop down list that matches with the key word given in other text box and display it a grid view.
Please help me out!!
<asp:Label ID="lbsbyprod" runat="server" Font-Bold="True"
Font-Names="Monotype Corsiva" ForeColor="White" Text="Search By"></asp:Label>
<asp:DropDownList ID="ddsbyprod" runat="server" Height="22px"
style="margin-left: 27px" Width="130px">
<asp:ListItem Value="POS004_ITEM_ID">Item ID</asp:ListItem>
<asp:ListItem Value="POS004_ALT_ID">Alternate ID</asp:ListItem>
</asp:DropDownList>
<asp:Label ID="lbsvprod" runat="server" Font-Bold="True"
Font-Names="Monotype Corsiva" ForeColor="White" Text="Search Value"></asp:Label>
<asp:TextBox ID="tbsvprod" runat="server"></asp:TextBox>
<asp:Button ID="btnsrchprodmst" runat="server" onclick="btnsrchprodmst_Click"
Text="Search" />
<asp:GridView ID="gv1" runat="server" DataSourceID="SqlDataSource5">
</asp:GridView>
//CODE FOR SEARCH BUTTON
protected void btnsrchprodmst_Click(object sender, EventArgs e)
{
SqlConnection con = new SqlConnection("Data Source=SPSERVER;Initial Catalog=SuperPOS;Integrated Security=True");
if (rblsrcht.SelectedValue == "Exactly")
{
string itemmstsrch = "select POS004_ITEM_ID,POS004_DESC,POS004_SALE_PRICE2,POS004_AVAIL_QTY,POS004_UNITS from POS_ITEMMST_004 where '"+ddsbyprod.SelectedValue+"' like '" + tbsvprod.Text + "'";
con.Open();
SqlCommand cmd = new SqlCommand(itemmstsrch,con);
cmd.ExecuteNonQuery();
this.gv1.DataBind();
con.Close();
}

New Topic/Question
Reply



MultiQuote







|