|
I want to make an ASP.NET page that outputs xml (using ContentType="text/xml", XmlTextWriter, etc...) oddly enough when I run it the web tries to read it as HTML, even though it looks like xml in the code (I'm only running it with the development server), so I'm trying to push on. Anyway, when I try to use it with the XmlDataSource it reads the file instead of processing it and then reading the XML output.
The error is: Name cannot begin with the '%' character, hexadecimal value 0x25. Line 1, position 2
The line it's refering to is: <%@ Page ContentType="text/xml" %>
Is there anyway to do what I want?
Thanks for the help.
-- modified at 23:49 Tuesday 13th June, 2006
|
|
|
|
|
Actually, you can run the ASP.NET application on the dev server and view the web page output as xml in the browser. You now can try to shut down the running dev web server, then launch the web page with the ContentType="text/xml" again. If you still see the output as html:
+ You can simply try viewing a static xml file and see if it is displayed properly.
+ You can set the Trace="true" in the Page directive and check the ContentType setting in the output
Also, the web page .aspx with the Page directive is not well-formed in XML, so you cannot use the XmlDataSource to read the file content.
|
|
|
|
|
Thanks, I guess the restart worked since it's displaying correctly this morning.
Is there any (easy) way to have the server generate an xml page that feeds an XmlDataSource? My main goal is to have two ways to view the info on my site:
1. Using the site, just like any other site
2. Using RSS
My goal was to do this by using XmlDataSource connect to an aspx file that outputted RSS so I could us it in the sites frame work or have an RSS reader hit the same aspx file. This way I only have to maintain the one page that outputs to both. Would I be better off to just make two pages?
I hope I explained this well, thanks.
|
|
|
|
|
|
I've got a site with dynamically loaded user controls (.NET 1.1). These controls make use of the page UIculture to adjust their output.
One of these dynamic controls is a dropdown that allows language(culture) selection.
The problem is, by the time the IndexChanged event fires to change the page culture, it is possible that other dynamically loaded controls have already loaded and used the old page culture.
From what I've read, mostly (.NET 2.0), it appears that manually getting the value of a dropdown from the form is required and override the InitializeCulture method (which doesn't exist in 1.1)
The above approach is difficult if the control is dynamically loaded as the control ID may not always be the same.
Ideas?
Thanks in advance.
|
|
|
|
|
Actually, if the dynamic control uses the current culture info in the rendering phase which happens after the post data changed event (such as the SelectedIndexChanged event of the dropdownlist), then the updated culture still takes effect. One of the examples for such a control is the Calendar. If your dynamic control uses the current culture before the IndexChanged event occurs, you might need to reload control or the web page. In the ASP.NET 2.0, if you use the resource expression with localization, you then need to override the InitializeCulture method as you know to programmatically set the culture info for the current thread. The reason for this is that this method is called before the resource expression is populated, so it makes sure that the resource is loaded properly. If you set the culture info after the resource is loaded, it does not have any effect for the resource expression, but it might affect the code using the cultureinfo which runs after the changes.
|
|
|
|
|
Update:
I've thought about it some more. I do have controls that do some culture specific initialization work that happens before the prerender stage. So doing the culture change in the IndexChanged event will cause problems.
What I am trying now is basically the same method suggested in some 2.0 documentation I read. That is reading the Request.Form[ controlName ] value in the Init phase and setting it there.
In order to get around the problem of controlName changing due to dynamically added controls, I plan to use the following at runtime when the control is added.
Session["SelectLanguageControlID"] = ctrl.UniqueID;
This way, I can pull the value of controlName out of the session and retrieve my new value from the form during the Init phase.
I'm not sure I like the architechture of this design... but it seems to be the best I've got so far.
|
|
|
|
|
The Session data is accessible to all the web pages within the user context, so if data is specific for a web page, IMHO you may think of a way to persist the control id in the web page scope, for example using the ViewState. However, the ViewState data is loaded after the Init phase, so you can manage to use the hidden field in the way you want.
|
|
|
|
|
if my xml file looks like this
<br />
<br />
<root><br />
<title></title><br />
<article><br />
<header></header> <br />
<subheader></subheader><br />
<paragraph></paragraph> <br />
<paragraph></paragraph<br />
<paragraph></paragraph><br />
</article><br />
</root>
My XSL stops reading at the 1st paragrapgh if i make a for loop that loops through each article.
When i make a nested loop that loops through paragraphs inside the article loop it just stops working and if i use a loop after another loop the second loop returns nothing ?
What should i be doing in my XSL to read XML with mutliples of the same element inside a single other element?
Or should XML not be formatted like this?
Cheers.
|
|
|
|
|
In fact, you can make it work with a nested loop in the xsl document for the paragraph element inside the article loop. You might need to double check your xsl document and you can see the sample script from here[^], and IMO your question should belong to the xsl forum.
|
|
|
|
|
I have a security form authentication in my ASP site, I want to display the login username to the entire pages of the site...What should I do...Thanks...
NB
|
|
|
|
|
If you are using the ASP.NET 2, you can simply use the LoginName control in the Master page, and have all the web page use this master page. You can alse use a web user control to display the logon username and make use of this control in all the web pages.
|
|
|
|
|
I have a web site that I configure differently for various clients. Each client gets the same core set of code with different add on pieces. I want to keep the common configuration info in Web.Config and use user.config to contain the information that is specific to each client's configiration. From everything I can tell about the use of user.config, this is a very appropriate use of the feature; however, the values I place in the user.config file are not read until a long period of time (often over 30 minutes) passes. I can change web.config values and they take effect immediately; however I cannot get the values in user.config to update properly.
I am using the <appSettings file="user.config">, and the settings in user.config will take effect eventually. I need them to take effect immediately.
Any ideas?
Bob Jones
DeWaard & Jones Company
Bellingham, WA
|
|
|
|
|
As you know that with the external config file you can allow the user to update the file without requiring the application restart, so if you want the updates in the custom config file to take effect immediately, you either manage to watch the file using the FileSystemWatcher class or have the ASP.NET do that by placing the custom file in a specific folder tracked by the ASP.NET like the bin directory.
|
|
|
|
|
Interesting information. My user.config file is located in the same directory as the web.config file, the home directory of the web site. Is this location not tracked?
|
|
|
|
|
In this case, the ASP.NET is just aware of the web.config file only.
|
|
|
|
|
Hello All
i h a gridview with paging
i h also edit button when i click on edit button of row 2 of page 4 it return index number 1
but infaact index number in whole data set is
index=4*7 (page size)+1 which mean 29
for this i h three variable name as page number
page size
and index number
but problem is on post back all these variables shows zero value except index number which show one in this case
to avoid this i used static variable which retain last value
but on web static variable cause some problem becase these are shared variable pls tell me how i can retain values without being affected by post back
also on post back data set get empty
any solution
Regards
Masood
|
|
|
|
|
What do you want to do with this index value? Do you want to use it to pick up the selected data row in the dataset? If so, you simply persist the id value using the DataKeyNames[^] property, and you can access the selected id from the DataKeys collection.
|
|
|
|
|
I am using calendar in my project. At Page_Load i make the calendar visible=false and it become visible with a button click but when it become visible i can not pick any date. Does anyone knows how to solve this problem?
|
|
|
|
|
Do you mean that when the calendar becomes visible you can see it on the web page but you cannot select any date or the control gives you nothing at the server side? Could you be more specific with code snippets?
|
|
|
|
|
Hello,
I have a need after every 8 rows in a Repeater I make a <TR> visible.
Is this even possible? If so, how would I go about it.
Thank so much for the help.
RB
|
|
|
|
|
Where do you define the tr element? I guess that you may use the ItemCreated/ItemDataBound events to count the RepeaterItem, then you can make the tr visible/invisible in the way you want.
|
|
|
|
|
Hello,
I try to register a gif to my asp page.
I have an img tag that contains an image and by pressing a button I want to change the image.
Actually I have here two questions:
1 - How do I register the image so I can change it using the JavaScript?
2 - How do I refer to the Image using the JavaScript?
Thanks a lot,
Yossi
|
|
|
|
|
You can use the getElementById[^] method to get reference to img element, then change the Src[^] property.
|
|
|
|
|
Hi to all. Sorry, my english is bad.
I have a problem. Let I have file X:\a.dat, where X - network device. Function in my web-service check existence of this file:
<br />
FileInfo fileInfo = new FileInfo(@"X:\a.dat");<br />
if (fileInfo.Exists)<br />
.................<br />
This code returns false, but it really exists. Then access denied. I set username="Administrator of local machine" password="His password" in web.config's <processmodel> section. But problem didn't solve. But if I check \\servername\sharename\a.dat then it is work.
Please, help me.
|
|
|
|