cclooksgood
Posts: 48
|
Posted: 05/31/2009, 11:41 AM |
|
Hello,
I have done a great deal of browsing through the forums here looking for my solution.
What I know and What I need...
I need the ability to use a different header file (include file) that contains both HTML and dynamic data from a SQL database based on an ID.....
I didnt think this was possible to dynamically use different include files. But since then I have heard that INMotion.NET may be the only platform where this is possible.
I need somebody to help me with this and I will donate using PAYPAL.... straight forward
I need somebody that instantly walk me through this on the phone.... You will be to see results immediately, Please no discovery time here, I want somebody that either has done it or done something similar.....
INMOTION C#
SQL
|
|
|
peterr
Posts: 5971
|
Posted: 05/31/2009, 6:14 PM |
|
Hi,
If you don't hear from anyone I will try to check into this on Monday or Tuesday.
_________________
Peter R.
YesSoftware Forums Moderator
For product support please visit http://support.yessoftware.com |
|
|
robertmann
Posts: 109
|
Posted: 06/01/2009, 12:55 AM |
|
I played with this before by creating components dynamically and incl page was one component. I will find a sample later when get to work.
sent from somePhone
_________________
Robert |
|
|
robertmann
Posts: 109
|
Posted: 06/01/2009, 3:26 AM |
|
Try: create a page with panel. It can be simple.
<meta http-equiv="content-type" content="application/xhtml+xml; charset=utf-8" />
<!-- BEGIN Panel Panel1 --><!-- END Panel Panel1 -->
And use such code to add includable page dynamically inside your panel.
//Event is after initialize for the page
//Define includable page and panel name
string IncludablePageName = "IncludablePageName.ascx";
string PanelName = "Panel1";
//Include page into panel
MTUserControl inclControl = (MTUserControl)TemplateControl.LoadControl(IncludablePageName);
MTPanel inclPanel = GetControl<MTPanel>(PanelName);
inclPanel.Controls.Add(inclControl);
It is minimum info but must be enough. It works.
You can get multiple or dynamic page from database and include in panel but next code is not tested.
string IncludablePageName;
MTUserControl inclControl;
MTPanel inclPanel = GetControl<MTPanel>("Panel1");
DbDataReader reader = DataUtility.ExecuteReader("SELECT page_name FROM pages", "InMotion:Connection1");
if (reader.Read())
{
IncludablePageName = reader.GetValue(0) as string;
inclControl = (MTUserControl)TemplateControl.LoadControl(IncludablePageName);
inclPanel.Controls.Add(inclControl);
}
reader.Close();
I dont have paypal but no need for it.
_________________
Robert |
|
|
cclooksgood
Posts: 48
|
Posted: 06/01/2009, 9:10 AM |
|
Thank you Robert,
I am going to try it this morning...
|
|
|
cclooksgood
Posts: 48
|
Posted: 06/06/2009, 9:26 AM |
|
Robert,
Your code worked at every level, impressive and I appreciate it. I just now have to extend it just a bit..... Right now it allows me to hardcode the id into the code which then goes to the dbase and pulls the name of the include file I want on the page.....see below
What I need to do now is not hardcode the ID (11639) in the index.aspx page but instead I need to get the ID value from the url and then go to the dbase and find out what include page to load.
example URL: 123.com/index.aspx?id=11639
The index.aspx page loads the inludepage.ascx page because that is the value in the dbase.
Your code below with my values
_________________________________________________________________
string IncludablePageName;
MTUserControl inclControl;
MTPanel inclPanel = GetControl<MTPanel>("Panel1");
DbDataReader reader = DataUtility.ExecuteReader("SELECT header FROM websiteinfo where orgid=11639", "InMotion:beachcities");
if (reader.Read())
{
IncludablePageName = reader.GetValue(0) as string;
inclControl = (MTUserControl)TemplateControl.LoadControl(IncludablePageName);
inclPanel.Controls.Add(inclControl);
}
reader.Close();
________________________________________________________________
I just need the syntax that would replace "orgid=11639" which gets the value from the URL
Thanks a bunch!
|
|
|