I am retrieving Data into Textbox, dropdownlist and Label
string strQuery = "select Codeitem,Orderno,Prdqty,PID From Probale where" +
" Prdno = @Prdno and DelID is null ";
SqlCommand cmde = new SqlCommand();
cmde.Parameters.AddWithValue("@Prdno", TextBox1.Text);
cmde.CommandType = CommandType.Text;
cmde.CommandText = strQuery;
cmde.Connection = con;
try
{
con.Open();
SqlDataReader sdr = cmde.ExecuteReader();
while (sdr.Read())
{
//DropDownList1.SelectedValue = sdr[0].ToString();
DropDownList1.SelectedValue = sdr["Codeitem"].ToString();
txtorderno.Text = sdr["Orderno"].ToString();
txtqty.Text = sdr["Prdqty"].ToString();
txtpid.Text = sdr["PID"].ToString();
lbmsg.Text = "";
lbgv.Text = "";
}
}
catch (Exception ex)
{
//throw ex;
}
con.Close();
Then i am using IF/Else condition(is it effecive.?)
Now i want to use Switch Statement instead of IF/Else
below is condition.
if (txtpid.Text != "" && txtpid.Text != "1")
{
Response.Write("<script language='javascript'>alert('Bale Already Packed');</script>");
}
else if(txtOrder.Text == "")
{
Response.Write("<script language='javascript'>alert('Please Input Orderno');</script>");
Label1.Text = "";
TextBox1.Text = "";
txtqty.Text = "";
txtorderno.Text = "";
DropDownList1.SelectedValue = "";
}