Hello Community!
I am trying to find a solution to dynamically create TabStrip with MultiPage and Pageviews with UserControls from a SQL database.
Here is what I have thus far.
SQL Table: ID, ParentID, TabName, URL, Position, NavBar, Page, and Active columns.
I store the path to the webpage and UserControls in the URL column.
The rest of the columns are for sorting and visibility per user/page/etc.
Here is my HeaderControl.ascx code.
Here is my codeBehind.
All classes are derived from a class.dll file I have created. Everything work perfectly except the UserControls for each of the PageViews. Each Main Navigation when clicked on will produce Sub Navigation Tabs which works fine. The PageViews are created as well but each of those PageViews will have a different UserControl. These UserControls paths are read from the URL column in SQL. BAsed on the NC.ReturnUserControls Class how can I make this work? Am I missing an iteration or something like it?
Thanks for any replies!
I am trying to find a solution to dynamically create TabStrip with MultiPage and Pageviews with UserControls from a SQL database.
Here is what I have thus far.
SQL Table: ID, ParentID, TabName, URL, Position, NavBar, Page, and Active columns.
I store the path to the webpage and UserControls in the URL column.
The rest of the columns are for sorting and visibility per user/page/etc.
Here is my HeaderControl.ascx code.
<telerik:RadTabStrip ID=
"RadTabStrip1"
runat=
"server"
MultiPageID=
"RadMultiPage1"
SelectedIndex=
"0"
CausesValidation=
"False"
Skin=
"Black"
Width=
"100%"
></telerik:RadTabStrip>
<telerik:RadMultiPage ID=
"RadMultiPage1"
runat=
"server"
SelectedIndex=
"0"
></telerik:RadMultiPage>
Here is my codeBehind.
public
int
_Page;
protected
void
Page_Load(
object
sender, EventArgs e)
{
int
_FID = Convert.ToInt32(Session[
"_FID"
]);
int
_AID = Convert.ToInt32(Session[
"_AID"
]);
IMasterPage masterPage = Page.Master
as
IMasterPage;
if
(masterPage.bodyID ==
"DB"
)
{
_Page = 1;
Page.Title =
string
.Format(
"Virtual Law Desk :: Dashboard"
);
}
else
if
(masterPage.bodyID ==
"CM"
)
{
_Page = 2;
Page.Title =
string
.Format(
"Virtual Law Desk :: Client Management"
);
}
StandardClass SC =
new
StandardClass();
{
if
(!SC.IsError)
{
SC.ReturnLawfirmUser(_FID, _AID);
{
fnLbl.Text = SC.FirstName;
lnLbl.Text = SC.LastName;
}
}
}
NavigationClass NC =
new
NavigationClass();
{
if
(!NC.IsError)
{
RadMenu1.DataSource = NC.ReturnTabNavigation();
RadMenu1.DataTextField =
"tabname"
;
RadMenu1.DataNavigateUrlField =
"url"
;
RadMenu1.DataValueField =
"pid"
;
RadMenu1.DataFieldID =
"id"
;
RadMenu1.DataBind();
RadTabStrip1.DataSource = NC.ReturnSubTabNavigation(_Page);
RadTabStrip1.DataTextField =
"tabname"
;
//RadTabStrip1.DataNavigateUrlField = "url";
RadTabStrip1.DataValueField =
"pid"
;
RadTabStrip1.DataFieldID =
"id"
;
RadTabStrip1.SelectedIndex = -1;
RadTabStrip1.DataBind();
RadPageView pageView =
new
RadPageView();
pageView.ID =
"pid"
;
RadMultiPage MultiPage1 = RadMultiPage1;
MultiPage1.PageViews.Add(pageView);
NC.ReturnUserControls(_Page);
{
Control userControl = Page.LoadControl(NC.URL);
pageView.Controls.Add(userControl);
}
}
}
}
All classes are derived from a class.dll file I have created. Everything work perfectly except the UserControls for each of the PageViews. Each Main Navigation when clicked on will produce Sub Navigation Tabs which works fine. The PageViews are created as well but each of those PageViews will have a different UserControl. These UserControls paths are read from the URL column in SQL. BAsed on the NC.ReturnUserControls Class how can I make this work? Am I missing an iteration or something like it?
Thanks for any replies!