ednayap Posted June 18, 2003 Posted June 18, 2003 hie all! i have this very weird problem... i've already set my label visibility to false in the settings of the label (using asp web matrix) and it works , my label didn't appear but in the codes i've made it to appear again by doing so, Label1.Visible = True but my label never appeared.... how can i make it appear? tanx a lot :D Quote ##EYPS##
hrabia Posted June 18, 2003 Posted June 18, 2003 Show your code :) Quote A man and a dog have an average of three legs. Beaware of Statistics.
petrosken Posted June 18, 2003 Posted June 18, 2003 I think you should put the Label1.Visible = true in your Page_Load event handler. This is called after all the contructor of the objects so it should affect their behavior. It's usually not good to place code outside the functions in perfect ASP style :) in ASPX pages. If this does not work try posting the relevant pieces of code, and maybe I can help you LP. Quote
ednayap Posted June 18, 2003 Author Posted June 18, 2003 okay..this are my codes... hope it helps :-\ Sub Page_Load DropDownList1.Items.Clear() TextBox1.Text= "" TextBox10.Text = "" TextBox2.Text = "" TextBox11.Text= "" TextBox12.Text= "" TextBox13.Text= "" TextBox15.Text= "" TextBox16.Text= "" TextBox17.Text= "" TextBox18.Text= "" DropDownList1.Items.Add("Ordinary") DropDownList1.Items.Add("Administrator") end sub Sub Add_Click (s as Object, e As EventArgs) if IsValid then dim conn, conn2, conn3 as SqlConnection dim strIns, strIns2, uname as String dim cmdInsert,cmdInsert2, cmdSelectLogin as SqlCommand dim login as SqlDataReader dim check as boolean conn3 = new SqlConnection("Server=localhost;User Id=sa;Password=edna;database=TA") conn3.Open() cmdSelectLogin= new SqlCommand ("Select Name From Passwd", conn3) login =cmdSelectLogin.ExecuteReader() check = true uname = TextBox10.Text While login.Read() if login("Name") = uname then check = false Label1.Visible = True end if end while login.Close() conn3.Close() if check = true then conn = new SqlConnection("Server=localhost;User Id=sa;Password=edna;database=TA") strIns = "Insert Profile (FName, DOB, HP, House, Address, Email, Exmail, Name, IC) Values (@fname,@dob,@hp,@house,@address,@email,@exmail,@name,@ic)" cmdInsert = New SqlCommand(strIns, conn) cmdInsert.Parameters.Add("@fname",TextBox12.Text) cmdInsert.Parameters.Add("@dob",TextBox15.Text) cmdInsert.Parameters.Add("@hp",TextBox16.Text) cmdInsert.Parameters.Add("@house",TextBox17.Text) cmdInsert.Parameters.Add("@address",TextBox2.Text) cmdInsert.Parameters.Add("@email",TextBox18.Text) cmdInsert.Parameters.Add("@exmail",TextBox1.Text) cmdInsert.Parameters.Add("@name",TextBox10.Text) cmdInsert.Parameters.Add("@ic",TextBox13.Text) conn.Open() cmdInsert.ExecuteNonQuery() conn.Close() conn2 = new SqlConnection("Server=localhost;User Id=sa;Password=edna;database=TA") strIns2 = "Insert Passwd (Name,Password) Values (@name2,@password)" cmdInsert2 = New SqlCommand(strIns2, conn2) cmdInsert2.Parameters.Add("@name2",TextBox10.Text) cmdInsert2.Parameters.Add("@password",TextBox11.Text) conn2.Open() cmdInsert2.ExecuteNonQuery() conn.Close() else Label1.Visible = True end if end if end sub Quote ##EYPS##
Neutrino Posted June 18, 2003 Posted June 18, 2003 Better try the debug feature of VS.Net and see whether that piece of code gets executed. I c that u have this logic out there: While login.Read() if login("Name") = uname then check = false Label1.Visible = True end if end while It could be that the line doesn't get executed. also I c that ur checking some value against another value from the database. So better do a trim of both and if it is case sensitive get them both to the same case. Amicalement, Neutrino. "Life grows when shared". Quote
hrabia Posted June 18, 2003 Posted June 18, 2003 Label1.Visible = true works fine in Page_Load event so try to debug your code and find out why your check variable has always true value. Quote A man and a dog have an average of three legs. Beaware of Statistics.
ednayap Posted June 18, 2003 Author Posted June 18, 2003 hmm okay i'll try that out tanx Quote ##EYPS##
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.