Hi,
I stored in a database a ntext "<b>Hello</b>";
But when I read it from the database I see <b>Hello</b> instead of Hello.
In the html source I see this: <b>Hello</b>
Any Idea?
Thanks
View Complete Post
I have two methods:
Encode - takes a string, converts it to array of bytes, uses bytes to specify colors, creates a color and sets a pixel based on bytes
Decode - takes a pixel, retrieves color (R,G,B) bytes and converts them to characters, that produces a string which was previously encoded
I'm using two for loops (img height/width) to specify position and access pixels
The issue is that once display (Control Panel\Appearance and Personalization\Display) changes to anything other then "Smaller - 100%",bytes have different values during decoding, thus different string is produced (corrupted).
If the setting is set to "Smaller - 100%" the results are normal.
What can I do to avoid that problem?
Thanks in advance
Since all calls to methods (using Razor View Engine and syntax) that return strings have their result Html encoded, is there a way (or an option) to not have the return values html encoded?
For example if I have a simple method like so:
protected string RenderTable(IEnumerable<T> data) { /* Return some html */ }
and then in a view (using the Razor View engine) I have code like this:
@{RenderTable(Model);}
I'd like the returned string to be inserted into the view as-is and not Html encoded.
What are my options?
Hi All, I am facing an issue. I have a datagrid in aspx page. I am binding a dataset data to this datagrid [simple binding]. It works with out any issues. However whenever the data contains any Html tags like 'Test Data With <HTML> tags' the data in the datagrid cell will show only 'Test Data With <> tags'. The contents inside <> tag will disappear. My code will look like this. DataGrid.DataSource = SomeDataSet DataGrid.DataBind() I am using C# as the code behind language. Also the data population to the grid is dynamic and depends on the SQL Query used for it. Hence my columns are not predefined. The DataGrid's AutoGeneratedColumns property is True [Number of columns and columns header will change dynamically depending on the query which pulls the data from the DB] Kindly help with this. Thanks in advance Sathya
It's great that Razor HTML encodes by default. However, many times I have HTML in a database and want to display it literally on a page. In WebForms 4, we can use <%= %> and <%: %> to choose between encoding options. Raven's syntax is currently @(new HtmlString(Model.Greeting)). This is far too verbose.
Please add a shorter syntax to Razor. Something like @=Model.Greeting or @@Model.Greeting, or something else.
Hi All,
I am new to Asp.net MVC 2. I am unable to get value for Html.TextBoxFor(m = > m.name) in view. I can get this value in Controller.
How to get this value in view.
Please help.
When inserting a simple embed of youtube inside the ajax editor, on firefox and chrome problems occur. On the other hand on internet explorer 8 everything works fine. I found this solution http://www.nopcommerce.com/boards/t/4228/bug-in-ajax-html-editor.aspx .
My question is where do I find the DesignPanel.pre.js ?
Thanks,
Roderick Vella
I have an HTML <div> container that I float to the right of a gridview. When the browser window is maximized, it looks fine. When minimized, the gridview positions below the floating container and most of the data is pushed off the bottom of the browser - you have to scroll down to see it.
If I position the floating container above the gridview it looks fine in a minimized window, but looks real bad when maximized.
What I want to do is use a javascript: onresize event to re-position the floating container up or down depending on the window.inner.width AND do it with a Master/Content page structure AND do it for only the one page where needed.
I can capture the onresize event and display the window dimensions but haven't figured-out how to do it with a Content page that still uses the Master page. I think I'm having a very "thick" week...
- Tinker
I am having an html img tag in which the user is being shown images. However I now want to open a url when the user clicks my img. What do I need to do to be able to achieve this?
In VS 2008 there is a very useful feature of background HTML validation - it checks if CSS class name is valid i.e. it exists in one of the linked css files. But VS 2010 Express does not do that any more. And the relevant setting in Options->Text Editor->HTML->Validation->in CSS is not there. Ok, maybe they made it paid for option? VS 2010 Professional? Not there. Or maybe VS 2010 Ultimate? Not a trace.
1. am I blind?
2. they decided it is too convenient to use and removed it?
3. they will "introduce" it in SP1?
What is going on? That one thing made me move back to VS 2008 web developer.
Maciej
Hey guys,
Have been VWD for a while now but VWD2010 seems to have one really annoying habbit. I'll write a whole load HTML with server tags and when I save, not always but quite often, VWD will squash all tags together in seemingly random arrangement completely removing my formatting conventions that make it easy for me to read. All the tags are still in the right order and makes no difference to how the page works, it just makes it really difficult to read quickly when scanning over it looking for a particular section.
For example:
<asp:Panel ID="pnlConfirm" runat="server" Visible="false"> <asp:Table ID="tblConfBilling" runat="server"> <asp:TableRow> <asp:TableCell>Name:</asp:TableCell> <asp:TableCell> <asp:Label ID="lblName" runat="server" Text="" /> </asp:TableCell> </asp:TableRow> <asp:TableRow> <asp:TableCell>Address:</asp:TableCell> <asp:TableCell> <asp:Label ID="lblAddress" runat="server" Text="" />
Downloaded the code from here:
http://blog.osbornm.com/archive/2010/07/21/using-simplemembership-with-asp.net-webpages.aspx
The Register.cshtml is having commented code which enables sending email to users for email verification.
This is the link not getting resolved properly in the email:
var confirmationLink = Html.PageLink("~\\Account\\Confirm", "click to Ccnfirm your Account.", new {token = token});
Mail.Send(email, "Confirm Your Security Demo Account", confirmationLink.ToString());
It is opening something like this: http://confirm/?token=tR9nWxnBPN34Kag
Note: I get the email but the link is not resolved properly.
Just for workaround and testing I did this and it worked:
var confirmationLink = "<a href='http://localhost:50620/Account/Confirm.cshtml?token=" + token.ToString() +"'> Please Confirm Your Account </a>";
If anyone can share some light on this Html.PageLink method and why is it not working?<
I am having trouble finding out where and how to HTML Encode a cell's data on the Dynamic Data (v4.0) gridview of List.aspx. As a simple case, suppose I have formatted cell data that is A<br/>B in the DB. Obviously, I want A stacked on B in the cell.
It seems gridView1.HtmlEncode = true has gone away.
So maybe I'll try to catch it on the RowDataBound event:
protected void GridView1_RowDataBound(Object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { // Html Encode the cells } }
but this event never fires?
Has anyone figured out how to properly render HTML tags data in the List.aspx's GridView1?
If I figure this out, then I can add a MetaAttribute called something like [EncodeAsHtml(true)] and be on my way. Thanks!
Hi everybody,
I'm working on an ASP.NET application which writes xml sitemap to xml file. while I'm generating the loc element, I found that the writer converts the "&" in dynamic URLs to "&" which I think it's not acceptable by Google. is there any way to get out of this?
Part of my code is as follow:
writer.WriteStartElement("url") writer.WriteStartElement("loc") writer.WriteString("/english/pages/pages.aspx?sid=" + drSections("SectionID").ToString + "&pageid=" + drPages("PageID").ToString + "") writer.WriteEndElement() writer.WriteStartElement("lastmod") writer.WriteString(DateTime.Today.AddMonths(0).ToString("yyyy-MM-dd")) writer.WriteEndElement() writer.WriteStartElement("priority") writer.WriteString("0.5") writer.WriteEndElement() writer.WriteFullEndElement()
and my output comes like :
<?xml version="1.0" encoding="utf-8"?><urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"> <url>
I would like to create a html link button(in aspx page) so that the page could not post back and some controls to display on clicking link button.
Can any one of you help me regarding this issue?
Let me know if you have any queries.
Regards,
Kumar.
Hall of Fame Twitter Terms of Service Privacy Policy Contact Us Archives Tell A Friend