Showing posts with label bind. Show all posts
Showing posts with label bind. Show all posts

Saturday, March 31, 2012

Text box text from dataset

i have dataset with the result and i bind it to datagrid

in datagrid i use to display text for hyperlink

<asp:datagrid

'<%# DataBinder.Eval(Container.DataItem, "ForumName") %>'

</asp:datagrid>

now if i have hyperlink some where on page and i need the text of this hyperlink to show the forumname what user has selected.how to do that.the dataset has the result and i want the ForumName from the dataset to hyperlink which is on the page not in datagrid.

Hello,

The code below creates a GridView control that have a hyperlink column which

sends the ID to other page:

Here is the simple code which you can use:

<asp:GridView ID="GridView1" runat="server" BackColor="White" BorderColor="White"
BorderStyle="Ridge" BorderWidth="2px" CellPadding="3" CellSpacing="1"

GridLines="None" AutoGenerateColumns="False">
<FooterStyle BackColor="#C6C3C6" ForeColor="Black" />
<RowStyle BackColor="#DEDFDE" ForeColor="Black" />
<PagerStyle BackColor="#C6C3C6" ForeColor="Black" HorizontalAlign="Right" />
<SelectedRowStyle BackColor="#9471DE" Font-Bold="True" ForeColor="White" />
<HeaderStyle BackColor="#4A3C8C" Font-Bold="True" ForeColor="#E7E7FF" />
<Columns>
<asp:BoundField DataField="CategoryID" />
<asp:HyperLinkField DataNavigateUrlFields="CategoryID"

DataNavigateUrlFormatString="SmallWindow.aspx?id={0}"
DataTextField="CategoryName" NavigateUrl="SmallWindow.aspx" />
<asp:BoundField DataField="Description" />
</Columns>
</asp:GridView>


So, now when you click the CategoryName you will be redirected to SmallWindow.aspx page.

Saturday, March 24, 2012

text rendering problems

Hi - I have some text (type text) values stored in a SQL d-base (2005). The text already has html tags embedded in them. When I bind a value to a textbox for example it escapes the HTML values and does not treat them properly in the browser. How can I tell .NET (or SQL Server, not sure what is escaping the tags) to treat HTML tags in the text like HTML tags. For example if I view source on my aspx page I get the following:

This should be a <b> BOLD </b>

Making it not bold and actually showing the <b> </b> in the browser.

thanks

Paritally it's because controls like the TextBox cant handle HTML tags.

Also, look in the DB.. what's in there? The <..> or <... It may be a matter of how you are saving it


Use this controlhttp://freetextbox.com or use Response.Write(sbuffer);

Hope this helps

Al


the db does not have the < in the table. However, if the textbox control can't handle HTML tags that is probably it. Although I do not know what can't handle means. I would have guessed that the server side control itself does not handle the html tag....it would just spit the value out and the browser would handle it.

as far as the freetext box I will look at that...thanks.


What I mean by "cant handle" is that HTML is ignored.

Things like TextBox dont use HTML, only plain text. <b> is unknown to a TextBox where a Label understands it and interprets it, or rather allows the browser to...