CodeVerge.Net Beta


   Explore    Item Entry    Members      Register  Login  
NEWSGROUP
.NET
Algorithms-Data Structures
Asp.Net
C Plus Plus
CSharp
Database
HTML
Javascript
Linq
Other
Regular Expressions
VB.Net
XML





Zone: > NEWSGROUP > Asp.Net Forum > general_asp.net.master_pages_themes_and_navigation_controls Tags:
Item Type: NewsGroup Date Entered: 2/28/2008 9:45:39 PM Date Modified: Subscribers: 0 Subscribe Alert
Rate It:
(NR, 0)
XPoints: N/A Replies: 5 Views: 9 Favorited: 0 Favorite
Can Reply:  No Members Can Edit: No Online: Yes
6 Items, 1 Pages 1 |< << Go >> >|
kasamanthaw
Asp.Net User
how to add theme for a web page when it's calling form windows application using Web Request class2/28/2008 9:45:39 PM

0/0

Hi Everybody,

I want to apply theme for a web page when it's calling from windows application using web Request class.

Here is the code in windows application

public static string GetPageHTML(string url)

{

string strHtml = String.Empty;

try

{

Uri uri = new Uri(url);

WebRequest resq = WebRequest.CreateDefault(uri);

WebResponse resp = null;StreamReader sr;

resq.Timeout = 99999999;

resq.Credentials = CredentialCache.DefaultNetworkCredentials;

resq.PreAuthenticate = false;

resp = resq.GetResponse();

sr =
new StreamReader(resp.GetResponseStream());

strHtml = sr.ReadToEnd();

}

catch (Exception ex)

{

strHtml =
string.Empty;

//throw ex;

}

return strHtml;

}

}

 

here is the code in Web page Pre_Init Event

protected override void OnPreInit(EventArgs e)

{

DataTable dtBulletinInfo = BulletinInfo.GetBulletinStyles(CookiesInfo.ClubId);if (dtBulletinInfo.Rows.Count > 0)

{

wfAccPageId =
Convert.ToInt32(dtBulletinInfo.Rows[0]["wfAccPageId"]);

}

if (wfAccPageId == 0)

{

Response.Redirect(
"~/NoAccess.htm", true);

}

else

{

}

//Get all the information of current account page info

DataTable dtAccPage = Bulletin.GetBulletinInfo(wfAccPageId).Tables[0];if (dtAccPage.Rows.Count > 0)

{

DataRow drAccPage = dtAccPage.Rows[0];

pageName = Utilities.Replace_Null(drAccPage["PageName"], string.Empty).ToString();if (Utilities.IsNullOrEmpty(pageURL))

{

pageURL = Utilities.GetPageUrl(_pageId);

}

themeName = Utilities.Replace_Null(drAccPage[
"ThemeName"], string.Empty).ToString();

masterPage = Utilities.Replace_Null(drAccPage["MasterPage"], string.Empty).ToString();

string SupportedLanguage = Utilities.Replace_Null(drAccPage["SupportedLanguage"], "1").ToString();langId = Int16.Parse(SupportedLanguage.Substring(0, 1));

 

templateId = Convert.ToInt32(Utilities.Replace_Null(drAccPage["TemplateId"], 1));

clubId = Convert.ToInt32(Utilities.Replace_Null(drAccPage["AccountId"], 0)); string cAbsolutePath = Request.Url.AbsolutePath;

if (cAbsolutePath.ToLower().IndexOf(pageURL.ToLower()) > 0) //Checking the Requested Page for home page is same as Home aspx file into the database

{

CookiesInfo.LangId = langId;

CookiesInfo.ClubId = clubId;

this.Title = pageName;

this.Theme = themeName;

this.MasterPageFile = "~/V5/TemplateFiles/" + masterPage;

DataTable tbZones = WfTemplateZones.GetTemplateZones(templateId);

foreach (DataRow dr in tbZones.Rows)

{

base.AddContentTemplate(dr["ZoneId"].ToString(),new CompiledTemplateBuilder(new BuildTemplateMethod(this.Build)));

}

}

else

{

Response.Redirect(
"~" + pageURL + "?cid=" + CookiesInfo.ClubId.ToString(), true);

}

}

else

{

Response.Redirect(
"~/NoAccess.htm", true);

}

base.OnPreInit(e);

}

 

On the Web Application relavent page I override the PreInit Event  with the Masterpage information and Theme .I get the content with out applying Theme.(Master page and Theme infomation are stored in DB).Please help me .

 

thank you

Sam

Amanda Wang - M
Asp.Net User
Re: how to add theme for a web page when it's calling form windows application using Web Request class3/3/2008 8:27:28 AM

0/0

Hi Sam,

Use your code tio have a try, we repro your problem. Maybe, you can report this isssue to the  following site in the formal way:  http://connect.microsoft.com/visualstudio/

But I would suggest that you use the webBrowser's Navigate method to load to display the web page, like this: this.webBrowser1.Navigate(strURL);  the theme will work fine.

 

 


Please remember to mark the replies as answers if they help and unmark them if they provide no help.


Yours sincerely,
Amanda Wang
Microsoft Online Community Support
kasamanthaw
Asp.Net User
Re: how to add theme for a web page when it's calling form windows application using Web Request class3/3/2008 3:46:18 PM

0/0

Hi Amanda,

Thank you for reply.What I do here is,Through the windows application using Web Request class,gets the content of the page and email it as Bulletin page.When I received the email I checked the source code of the email.It has theme info( <head id="ctl00_Head1"><title> Club weekly Bulletin </title><link href="../../../App_Themes/Spring/SpringStyle.css" type="text/css" ="stylesheet" /></head>).But I don't know weather the Theme file is can find or apply to the page when I get the content on Windows application.Do I need to construct the Bulletin Page on the Same Web Application instead of using separate windows application.The reason I did this is, to reduce the work load on IIS.Please help me with your suggestions.

thank you

Sam

Amanda Wang - M
Asp.Net User
Re: how to add theme for a web page when it's calling form windows application using Web Request class3/4/2008 2:50:57 AM

0/0

Hi,

In my test application, no matter whtat to set the theme for page or reference the css file by using link, the page will not apply the style when using the web request calss, but if you set the css style in the page's aspx file, the page can apply the css style by using the web request.

It is very weird.

So, in order to slove your problem, I would suugest you can put the css style in the page'a aspx file instead of using theme or referring the css file.

 

Hope it helps.


Please remember to mark the replies as answers if they help and unmark them if they provide no help.


Yours sincerely,
Amanda Wang
Microsoft Online Community Support
kasamanthaw
Asp.Net User
Re: how to add theme for a web page when it's calling form windows application using Web Request class3/4/2008 9:12:57 PM

0/0

Hi Amanda,

Thank you for your reply.In Our current version of the application in  classic asp I have a Bulletin.asp .In which I apply the Css file as link.In this one it apply as

<LINK href="<%=IP%>/CPrg/includes/<%=clubcss%>" rel=stylesheet>. but in New version I need to set the master page file and theme in the code behind file.Reason is I am overrding the Page_PreInit event to set these.

 Could you help me to set theme and MAsterpage file in code behind with Server IP.this is how currenty I set these two in PAge_PreInit Event.

this.MasterPageFile = "~/V5/TemplateFiles/Bulletin.master";

this.Theme='Spring";

 

thank you

Sam

Amanda Wang - M
Asp.Net User
Re: how to add theme for a web page when it's calling form windows application using Web Request class3/5/2008 2:42:37 AM

0/0

Hi,

kasamanthaw:

 Could you help me to set theme and MAsterpage file in code behind with Server IP.this is how currenty I set these two in PAge_PreInit Event.

You can try to pass the theme as a querystring with page's url, then set theme in the page_preinit event:

For example:

 public void Page_PreInit()
    {
        this.Page.Theme = Request.QueryString["theme"];
    }

Hope it helps.

 


Please remember to mark the replies as answers if they help and unmark them if they provide no help.


Yours sincerely,
Amanda Wang
Microsoft Online Community Support
6 Items, 1 Pages 1 |< << Go >> >|



Search This Site:


Meet Our Sponsors:



Other Resources:

Netware 6 and netware 6.5 with USB - novell.support.netware.6x ... ... Novell Forums > novell.support.netware.6x.administration-tools, Date: 5/12/2008 12:39:54 PM, Replies: 1, ... calling form windows application using web ...
ø How To Run A PHP Script In The Background | W-Shadow.com ø ... the footer of the page and only using it when there is a request being processed. ... Theme design by Vault9. Cthulhu generated this page with 39 queries, ...
Database-SQL-RDBMS HOW-TO document for Linux (PostgreSQL Object ... End user wants to develop an application ONCE using ISO SQL, ODBC, JDBC and ... It will be a great advantage to take the existing code and add missing features ...
>> Windows Forms >> Archive Page 50 17184: New to VB.NET - How can I add line numbers to DataGridView rows using VB.NET? ... 17284: C#: Windows Form Application (DLL) 17285: Delete row based on ...
>> Windows Forms >> Archive Page 28 9499: Combobox - pick from list or add new item. 9500: How to refresh the windows form? ... 9641: Access Windows Form Application variables from Class Library ...
Ext: Help [Archive] - Page 70 - Ext JS Forums Communicating 2 Windows. Issue capturing datefiled value in embedded form panel... How to get value selected with GridFilter using WebGet or WebInvoke? ...
PHP HOW-TO 20.1 Standalone MS Windows GUI applications using PHP. 21. Web Application Standards - Fusebox ... opensource, enterprise class web application platform It ...



 
All Times Are GMT