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

I have two things.

1.User Control viz. a Gridview.
2.Repeater, inside a div and appear on mouseover event of an span, on Masterpage

Well whenever I clicked on a Button, which is on another page and this page is inheriting the MasterPage, the user control gridview get updated and show the inserted data...
and the repeater should also be updated with the same...

Like If I want to make any DML on User Control Gridview on Button event simultaneously Repeater should get updated.

I tried to get Master Page on User Controls I got success in this but further when I tried get the object of repeater this tells me "object reference is not set to an instance".

here is the code...
On User Control

OdbcCommand com = new OdbcCommand("select,b.productname,b.ThumbImageUrl, a.price,,a.quantity  from tempcart a,product b where a.sessionid='" + Session["ID"] + "' and", con);
OdbcDataAdapter da = new OdbcDataAdapter(com);
DataSet ds = new DataSet();
GridView1.DataSource = ds;
if (ds.Tables[0].Rows.Count > 0) // here checking data in dataset
     MasterGrocery mstr = new MasterGrocery();  //Here I'm accessing the MasterPage
     Repeater rptr = (Repeater)mstr.FindControl("gvShow");
     rptr.DataSource = ds;
     HtmlControl bbbbb = (HtmlControl)mstr.FindControl("spnMyBag");
     bbbbb.Visible = true;

Please Guide me

Updated 19-Jun-11 20:39pm
[no name] 20-Jun-11 2:39am    
Edited for Code Block.

1 solution

you can access the master page controls in the user control like that

Share this answer
Manish Kumar Namdev 20-Jun-11 3:25am    
Thanks nit_singh for your guidence.
I got what I wanted to do...
nit_singh 20-Jun-11 3:29am    
your welcome

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