T
Tomek R.
Hello !
This post does'nt regard column hyperlink.
I just have single hyperlink and want to create it's NavigateUrl
dynamically.
This is my test page
<form id="Form1" method="post" runat="server">
<asp:HyperLink id="MyHLink" NavigateUrl='<%# geturl("123456") %>'
style="Z-INDEX: 101; LEFT: 280px; POSITION: absolute; TOP: 56px"
runat="server" >MyHLink</asp:HyperLink>
</form>
and my class behind
public class WebForm1 : System.Web.UI.Page
{
protected System.Web.UI.WebControls.HyperLink MyHLink;
private void Page_Load(object sender, System.EventArgs e)
{
// Put user code to initialize the page here
//this.MyHLink.NavigateUrl = MyString();
}
#region Web Form Designer generated code
override protected void OnInit(EventArgs e)
{
InitializeComponent();
base.OnInit(e);
}
private void InitializeComponent()
{
this.Load += new System.EventHandler(this.Page_Load);
}
#endregion
protected string geturl(string s)
{ return "www.mypage.com "+s; }
}
Resulting page includes hyperlink, but inactive - not href tag attached. The
syntax is O'K, I believe (no errors on page load).
I've spent a couple of hours for browsing the newsgroups but haven't find
working solution for HTML designing.
What means, I can do this but only when setting NavigateUrl in Page_Load
like this:
private void Page_Load(object sender, System.EventArgs e)
{
MyHLink.NavigateUrl = geturl("123456");
}
No matter what kind of Url I put (absolute, relative) - Page_Load works
every time.
The only reason I can think about, is that one: geturl and class-behind is
not accessible, when hyperlink is rendered based on design values.
Am I right ?
If yes, how about datagrid and TemplateItem column with hyperlink. In that
case settings like above work perfectly. What is the differences between
datagrid column and hyperlink on page ?
Regards,
This post does'nt regard column hyperlink.
I just have single hyperlink and want to create it's NavigateUrl
dynamically.
This is my test page
<form id="Form1" method="post" runat="server">
<asp:HyperLink id="MyHLink" NavigateUrl='<%# geturl("123456") %>'
style="Z-INDEX: 101; LEFT: 280px; POSITION: absolute; TOP: 56px"
runat="server" >MyHLink</asp:HyperLink>
</form>
and my class behind
public class WebForm1 : System.Web.UI.Page
{
protected System.Web.UI.WebControls.HyperLink MyHLink;
private void Page_Load(object sender, System.EventArgs e)
{
// Put user code to initialize the page here
//this.MyHLink.NavigateUrl = MyString();
}
#region Web Form Designer generated code
override protected void OnInit(EventArgs e)
{
InitializeComponent();
base.OnInit(e);
}
private void InitializeComponent()
{
this.Load += new System.EventHandler(this.Page_Load);
}
#endregion
protected string geturl(string s)
{ return "www.mypage.com "+s; }
}
Resulting page includes hyperlink, but inactive - not href tag attached. The
syntax is O'K, I believe (no errors on page load).
I've spent a couple of hours for browsing the newsgroups but haven't find
working solution for HTML designing.
What means, I can do this but only when setting NavigateUrl in Page_Load
like this:
private void Page_Load(object sender, System.EventArgs e)
{
MyHLink.NavigateUrl = geturl("123456");
}
No matter what kind of Url I put (absolute, relative) - Page_Load works
every time.
The only reason I can think about, is that one: geturl and class-behind is
not accessible, when hyperlink is rendered based on design values.
Am I right ?
If yes, how about datagrid and TemplateItem column with hyperlink. In that
case settings like above work perfectly. What is the differences between
datagrid column and hyperlink on page ?
Regards,