[.net] Visual Studio 2005 seems limited

Started by
17 comments, last by RizMan 17 years, 10 months ago
Hey I noticed their dataview method seems really limited. You can't make the results display an url. Example: a guestbook that displays a link of each persons name like previewMessage.aspx?guestID=1. They're all static. Is there a way around this? Without programming the whole code yourself to display the data?
Advertisement
Which version of it are you using?


There are a few:

Express
Standard
Professional
Enterprise architect etc, but I dont bother looking at those because...price range
JUST-CODE-IT.NETManaged DirectX & C# TutorialsForumsArticlesLinksSamples
Team Suite Edition
I completely don't follow what you're asking.
SlimDX | Ventspace Blog | Twitter | Diverse teams make better games. I am currently hiring capable C++ engine developers in Baltimore, MD.
It sounds like you're describing a problem with ASP not a problem with visual studio. Visual Studio is not a language, it's a tool with which you can compile/link languages like C++/VB/.NET/etc

Are you asking how to display a url with ASP?

-me
Perhaps your in need of the BoundField.HTMLEncode property? It's hard to get precisely what you're asking.
If I understood You correctly, then this is how I do it in my datagrid:
aspx page:



' runat="server">Clicky



codebehind:

public string GetLink(object id)
{
return String.Format("mypage.aspx?id={0}", id.ToString());
}
If I understood You correctly, then this is how I do it in my datagrid:
aspx page:

_asp:TemplateColumn_
_ItemTemplate_
_asp:HyperLink ID="link" NavigateUrl='_%# GetLink(DataBinder.Eval(Container.DataItem, "id")) %_' runat="server"_Clicky_/asp:HyperLink_
_/ItemTemplate_
_/asp:TemplateColumn_

codebehind:

public string GetLink(object id)
{
return String.Format("mypage.aspx?id={0}", id.ToString());
}

Or...

<itemtemplate>
_ a href='mypage.aspx?id= <%# (string)Eval("id") %>'_ Clicky _/a_
</itemtemplate>

The use of Eval in stead of Databinder.Eval is recommended in .net 2.0

Edo
Edo
Quote:Original post by Anonymous Poster
If I understood You correctly, then this is how I do it in my datagrid:
aspx page:

_asp:TemplateColumn_
_ItemTemplate_
_asp:HyperLink ID="link" NavigateUrl='_%# GetLink(DataBinder.Eval(Container.DataItem, "id")) %_' runat="server"_Clicky_/asp:HyperLink_
_/ItemTemplate_
_/asp:TemplateColumn_

codebehind:

public string GetLink(object id)
{
return String.Format("mypage.aspx?id={0}", id.ToString());
}


Are you trying to display the URL? If you are, then just set the 'Text' property of the asp:hyperlink to the same value as the 'NavigateUrl' property.

I.E.

<ItemTemplate>    <asp:HyperLink runat="server" id="linkName" NavigateUrl='<%# GetLink(DataBinder.Eval(Container.DataItem, "id")) %>' Text='<%# GetLink(DataBinder.Eval(Container.DataItem, "id")) %>'></ItemTemplate>

This topic is closed to new replies.

Advertisement