I'm trying to enter a little bit of HTML into an ASP.NET Dynamic Data MultilineText_Edit control, just a couple of <br> tags to have line breaks when I output the value of the column on a web page.
However, when I try to click the "Update" link on the Dynamic Data edit page, nothing happens. I don't even get an error message, which I would expect if HTML input were not allowed via some rule the control has built in. As soon as I remove the tag, the update link works correctly. It's not a column size issue, I can add a bunch more characters to the input and everything works fine.
Is HTML input not allowed in these controls, or is there something else going on? If there is some kind of validation rule, can it be turned off? Or is there something in the database that I need to set? Should I use something other than the default multiline text template?
Input validation is a built in feature in ASP.NET 2.0 or later. I don't know why you are not getting an error, but check this out to see if it helps:
http://www.asp.net/learn/whitepapers/request-validation/
Check these settings, on the page:
<%# Page validateRequest="false" %>
or the web.config:
<configuration>
<system.web>
<pages validateRequest="false" />
</system.web>
</configuration>
Related
I have compiled ASP.NET dynamic page with editable aspx pages.
I would like to some links to be generated upon changing some static variable
What i did is edit:
web.config as follows:
<appSettings>
<add key="currentEnvironment" value="dev-"/>
</appSettings>
and then
edited aspx page as follows
Home
But there is nothing appened when i try and run the .aspx page. Please help
You can't put a server tag inside another tag's markup like that, but you can just use the value directly. If you remove it and change the # to a =, it will work.
Home
Although if you can access the code behind, that would be a much cleaner way to do it, as in:
<asp:HyperLink ID="_index" runat="server">Home</asp:HyperLink>
and then set value from code behind
_index.NavigateUrl = String.Format("http://{0}www.mysite.com/web/index.html", ConfigurationSettings.AppSettings["currentEnvironment"]);
I have two user types: Readers and Authors. And I'm using Reader.Master and Author.Master for authorization purposes.
Then, there are StoriesR.aspx inherited from Reader.Master and StoriesA.aspx inherited from Author.Master. (In StoriesR.aspx page, you able to read the stories and in StoriesA.aspx you able to write the story.) So,
Reader.Master --> StoriesR.aspx
Author.Master --> StoriesA.aspx
Now, the thing is I don't want my users to see StoriesR.aspx?s=3 or StoriesA.aspx?s=3 in their browsers. I only want them to see stories?s=3. (even without the .aspx part)
How can I achieve this?
you can do this using urlMappings from web.config file
add in web.confing
<system.web>
<!--
Set compilation debug="true" to insert debugging
symbols into the compiled page. Because this
affects performance, set this value to true only
during development.
-->
<urlMappings enabled="true">
<add url="~/reader/stories" mappedUrl="~/reader/StoriesR.aspx"/>
<add url="~/author/stories" mappedUrl="~/author/StoriesA.aspx"/>
This will do url mapping.
You could have one aspx page and change the master page programmatically depending on what type of user they are, Author or Reader.
You can do this in the Page_PreInit event of your aspx page.
Check this c# example or this VB example
I have text box that allows the user to enter something which is stored in the database, and then another text box which retrieves this value from the database and displays it. Currently, I have something like this:
string text = Server.HTMLDecode(userEnteredText);
//code to put this text into the database
Textbox1.Text = Server.HTMLDecode(textFromDatabase);
The Server.HTMLDecode solves any problems encountered if a user enters the ' char.
However, I noticed if a user enters "'" into the textbox, then ASP gives a error again thinking the client is entering potentially dangerous text. Is there anyway around this? I notice on most sites that this is automatically turned into a apostrophe. Any idea how I do this to avoid user input problems?
If you're sure you want this, then set this in your web.config:
<system.web>
<httpRuntime requestValidationMode="2.0" />
<pages validateRequest="false" />
</system.web>
I have a web page abc.aspx using this page like master page, in this page i wrote a Html tag iframe using this i frame as content place holder.
I'm calling home.aspx page in this iframe tag.
in my home.aspx page i have some user-control. So , My question is
how can i able to implement the update panel in this scenario please tell me the solution.
Thank You,
Gorus.
After commenting the xhtmlConformance tag in web.config, update panel working normally.
<system.web>
<xhtmlConformance mode="Legacy" />
</system.web>
please refer below link....
http://weblogs.asp.net/scottgu/archive/2006/12/10/gotcha-don-t-use-xhtmlconformance-mode-legacy-with-asp-net-ajax.aspx
i have a problem that i have specified the color of RequiredFieldValidator to red but when i publish the website on net the color of RequiredFieldValidator is changed to black. it works fine in localhost. what could be the problem ?
thanks in advance..
Rohan,
This may have been your issue. I had the same problem.
By default, framework 4.0 will make all validator error messages black. You will need to explicitly set the ForeColor of all validators to red if you target framework 4.0.
Your source output in 3.5:
<span id="ctl01_YourControl" style="color:Red;visibility:hidden;">*</span>
Your source output in 4.0:
<span id="ctl01_YourControl" style="visibility:hidden;">*</span>
ASP.NET 4.0 has changes to output cleaner code, which include:
xhtmlConformance is set to Strict.
Menus are rendered as lists rather than tables
Extraneous properties like border=0 are removed from the emitted markup. Even the error text on validation controls is no longer set to red.
The rendering of the outer table for templated controls can now be controlled with the newRenderOuterTable property.
For compatibility, you can make your output look the same as it did in ASP.NET 3.5 with the controlRenderingCompatibilityVersion
> <?xml version="1.0"?> <configuration> <system.web>
> <compilation debug="false" targetFramework="4.0" />
> <pages controlRenderingCompatibilityVersion="3.5" /> </system.web> </configuration>
More information is available at http://msdn.microsoft.com/en-us/library/system.web.ui.control.renderingcompatibility.aspx.
I'm so happy to have resolved this. And I'm surprised I couldn't find more people posting about this same issue. It looks like the options in my case are to use this compatibility setting or set the ForeColor of all my validation controls to Red. (I'll probably do that latter.)
By default the validator is red - you shouldn't need to change it. Check your css to make sure it is not getting over ridden by anything. Also check the class that the requiredfieldvalidator is set to and make sure it does not include a color property.