Click here to Skip to main content
15,887,683 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
See more:
My previous post on this topic have been answered successfully.However when i access the method in the master page a error pops up saying object reference not set to an instance of an object..Heres the code

C#
public bool CheckErrors()
   {
       Page.Validate(valSummary.ValidationGroup);//error is in this line
       if (!Page.IsValid)
       {
           update.Update();
           modalPopupEx.Show();
           return false;
       }
       return true;
   }


my call to the method from the other form is

C#
protected void ImageButton2_Click(object sender, ImageClickEventArgs e)
    {
        SiteMaster master = (SiteMaster)this.Master;
        if (master.CheckErrors())
        {
            GridView2.Visible = false;
            gvsearch.Visible = true;

            string search = txtsearch.Text.ToString();
            gvsearch.DataSource = DataBase2.myProcedureName(search);
            gvsearch.DataBind();
        }
    }

Thanks
Posted
Comments
Ravi Sant 30-Aug-12 3:48am    
can you debug or add breakpoint at check, if valSummary actually has a value. I guess it is null (thus not accesible at error line).
BillWoodruff 31-Aug-12 7:32am    
What on earth is ".Master" ? What is "Page" ? If this is an ASP.NET question, please tag the question.

You can also add a link to the previous question to this question in case the "successful," you say, answer might give us a clue what you are asking here.

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