Need to Bind the GridView for Dynamically Loaded User control In Default Page.
-
Hi All, i am struck in between the logic. My question is i am loading the user control dynamically as follows. step1: --> In Defalut.aspx.cs--> page_Load i am written --> Control uc = LoadControl("MyUserControl"); PlaceHolder.Controls.Add(uc); step2: In UserControl there is GridView Control Need to bind the gridview only in "Default.aspx.cs" Can you please help me, how to bind the gridview control of usercontrol which is loaded and need to bind only in Defalut.aspx.cs Thanks in Advance.
JohnDas
-
Hi All, i am struck in between the logic. My question is i am loading the user control dynamically as follows. step1: --> In Defalut.aspx.cs--> page_Load i am written --> Control uc = LoadControl("MyUserControl"); PlaceHolder.Controls.Add(uc); step2: In UserControl there is GridView Control Need to bind the gridview only in "Default.aspx.cs" Can you please help me, how to bind the gridview control of usercontrol which is loaded and need to bind only in Defalut.aspx.cs Thanks in Advance.
JohnDas
Johndas wrote:
how to bind the gridview control of usercontrol
The way you normally would, assign the datasource and call DataBind.
Johndas wrote:
need to bind only in Defalut.aspx.cs
Set the data source for the gridview to null in this case.
only two letters away from being an asset
-
Hi All, i am struck in between the logic. My question is i am loading the user control dynamically as follows. step1: --> In Defalut.aspx.cs--> page_Load i am written --> Control uc = LoadControl("MyUserControl"); PlaceHolder.Controls.Add(uc); step2: In UserControl there is GridView Control Need to bind the gridview only in "Default.aspx.cs" Can you please help me, how to bind the gridview control of usercontrol which is loaded and need to bind only in Defalut.aspx.cs Thanks in Advance.
JohnDas
Make the gridview of the Usercontrol as public, Add
uc.gridView.DataSource= yourdatasource;
uc.gridView.DataBind();
//This is essential, as it is used to render html from datasource.Or you can modify the control to handle this itself .. :)
Abhishek Sur **Don't forget to click "Good Answer" if you like this Solution.
My Latest Articles-->** Microsoft Bing MAP using Javascript
CLR objects in SQL Server 2005
Uncommon C# Keywords/xml> -
Make the gridview of the Usercontrol as public, Add
uc.gridView.DataSource= yourdatasource;
uc.gridView.DataBind();
//This is essential, as it is used to render html from datasource.Or you can modify the control to handle this itself .. :)
Abhishek Sur **Don't forget to click "Good Answer" if you like this Solution.
My Latest Articles-->** Microsoft Bing MAP using Javascript
CLR objects in SQL Server 2005
Uncommon C# Keywords/xml>IMO, a very poor design to directly expose the controls within a user control or server control.
only two letters away from being an asset
-
IMO, a very poor design to directly expose the controls within a user control or server control.
only two letters away from being an asset
Ya. Then he can have a property(I thought the user already knows the use of properties ;P ) to expose the gridview... ;)
Abhishek Sur **Don't forget to click "Good Answer" if you like this Solution.
My Latest Articles-->** Microsoft Bing MAP using Javascript
CLR objects in SQL Server 2005
Uncommon C# Keywords/xml> -
Ya. Then he can have a property(I thought the user already knows the use of properties ;P ) to expose the gridview... ;)
Abhishek Sur **Don't forget to click "Good Answer" if you like this Solution.
My Latest Articles-->** Microsoft Bing MAP using Javascript
CLR objects in SQL Server 2005
Uncommon C# Keywords/xml>Then why the down vote?
only two letters away from being an asset
-
Then why the down vote?
only two letters away from being an asset
Sorry friend... Vote changed. :-D :rose:
Abhishek Sur **Don't forget to click "Good Answer" if you like this Solution.
My Latest Articles-->** Microsoft Bing MAP using Javascript
CLR objects in SQL Server 2005
Uncommon C# Keywords/xml> -
Sorry friend... Vote changed. :-D :rose:
Abhishek Sur **Don't forget to click "Good Answer" if you like this Solution.
My Latest Articles-->** Microsoft Bing MAP using Javascript
CLR objects in SQL Server 2005
Uncommon C# Keywords/xml>Thanks, but negated by pettiness from MarkyMark1961[^] I assume
only two letters away from being an asset
-
Thanks, but negated by pettiness from MarkyMark1961[^] I assume
only two letters away from being an asset
These downvoters have the opposite effect in the end. I've corrected the 1 votes.
Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
-
These downvoters have the opposite effect in the end. I've corrected the 1 votes.
Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
Thanks
only two letters away from being an asset