Click here to Skip to main content
15,897,518 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi
error

C#
protected void Page_Load(object sender, EventArgs e)
   {
       if (string.IsNullOrEmpty(TextBox1.Text))string.IsNullOrEmpty(TextBox2.Text)
       {
           Label1.Text="Nulls Not Valid";
           Label1.ForeColor.System.Drawing.Color.Red;
       }
       else
       {
           int c=0;
           for(inti=0;i<Info.GetLength(0);i++)
           {
               if(Info[i,0].ToString()==TextBox1.Text&&Info[i,1].ToString()==TextBox2.Text)
               {
                   c=1;
                   break;
               }
           }
           if(c==1)
           {
               Response.Redirect("Success.aspx");
           }
           else
           {
               Response.Redirect("Failed.aspx");
           }
Posted
Updated 13-Feb-14 18:10pm
v4
Comments
[no name] 14-Feb-14 0:05am    
What error you are getting..??
harshavardhan12345678 14-Feb-14 0:07am    
in this line
if (string.IsNullOrEmpty(TextBox1.Text))string.IsNullOrEmpty(TextBox2.Text)
{
[no name] 14-Feb-14 0:10am    
please share the full error you are getting..
harshavardhan12345678 14-Feb-14 0:15am    
bro
harshavardhan12345678 14-Feb-14 0:13am    
Error 1 ; expected C:\Users\bhagya\Documents\Visual Studio 2010\WebSites\server.excute\Default.aspx.cs 20 84 C:\...\server.excute\

Change the Code like

if (string.IsNullOrEmpty(TextBox1.Text) && string.IsNullOrEmpty(TextBox2.Text))
       {
           Label1.Text="Nulls Not Valid";
           Label1.ForeColor = System.Drawing.Color.Red;
       }
       else
       {
           int c=0;
           for(int i=0;i<info.getlength(0);i++)
           {
               if((Info[i,0].ToString()==TextBox1.Text)&&(Info[i,1].ToString()==TextBox2.Text))
               {
                   c=1;
                   break;
               }
           }
           if(c==1)
           {
               Response.Redirect("Success.aspx");
           }
           else
           {
               Response.Redirect("Failed.aspx");
           }
       }
 
Share this answer
 
v2
Fix this line
C#
if (string.IsNullOrEmpty(TextBox1.Text))string.IsNullOrEmpty(TextBox2.Text)

to
C#
if (string.IsNullOrEmpty(TextBox1.Text) || string.IsNullOrEmpty(TextBox2.Text))
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900