protected void txtQuantity_TextChanged(object sender, EventArgs e) { con.Open(); using (SqlCommand comm = new SqlCommand("select [Serial_Number_Required] from Products where Product=@Product ", con)) { //string Role = (string)(Session["Role"]); // 2. define parameters used in command object SqlParameter para = null; para = new SqlParameter(); para.ParameterName = "@Product"; para.Value = ddlProductName.SelectedValue; comm.Parameters.Add(para); //Pass @Pages parameter SqlDataReader reade = comm.ExecuteReader(); while (reade.Read()) { Session["Serial_Number_Required"] = Convert.ToString(reade["Serial_Number_Required"]); } con.Close(); //Button Add = (Button)PreviousPage.FindControl("Button2"); if (Session["Serial_Number_Required"].ToString() == "Y") { fun1(); } } }
<asp:TextBox ID="txtQuantity" runat="server" Width="150px" Height="16px" BackColor="White" AutoPostBack="True" ontextchanged="txtQuantity_TextChanged" ></asp:TextBox>
<asp:Button ID="Button2" runat="server" BackColor="#F4F4F4" CssClass="style4" Text="Add to GatePass" Font-Size="8.5pt" onchange="txtQuantity.TextChanged" Height="22px" onclick="Button2_Click" OnClientClick="javascript:return ValidateField()" Font-Bold="False" Width="120px" CausesValidation="False" >
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)