Ammar Iqbal
asked on
how to get the hyperlink working in C sharp string variable?
Hi,
I need to display a following message using dmessages severity level. The message is displayed but the hyperlink in that message is not working properly. Instead of going to the desired message, it simply refresges the page, and disappears the message.
my code script is given below
DisplayMessage method is being called over here
string msg=DisplayMessage();
dMessages.Controls.Add(add Message(ms g, 2));////
///////////////Body of Display Message
private string DisplayMessage()
{
HyperLink hlink = new HyperLink();
hlink.NavigateUrl = "~/Admin/CreateProject.asp x";
hlink.Text = "Create Project";
string message="You have not a created a project yet. Please go to the following link to do '" + hlink.Text + "'";
return message;
}
I need to display a following message using dmessages severity level. The message is displayed but the hyperlink in that message is not working properly. Instead of going to the desired message, it simply refresges the page, and disappears the message.
my code script is given below
DisplayMessage method is being called over here
string msg=DisplayMessage();
dMessages.Controls.Add(add
///////////////Body of Display Message
private string DisplayMessage()
{
HyperLink hlink = new HyperLink();
hlink.NavigateUrl = "~/Admin/CreateProject.asp
hlink.Text = "Create Project";
string message="You have not a created a project yet. Please go to the following link to do '" + hlink.Text + "'";
return message;
}
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
If I display this text thorugh a normal text box property, the hypeerlink works fine, but the problem is that I am using "dMessages" functionality. I displaying the message using a level of sevirty 2.
The message is displayed in red., but on clicking the link within the message, the message disaapears and then nothing.
I want to go to the create Project page once the hyperlink link within the message is displayed
The message is displayed in red., but on clicking the link within the message, the message disaapears and then nothing.
I want to go to the create Project page once the hyperlink link within the message is displayed
So you're saying the following:
- the message is displaying but the link does not work
- the messages dissapears after the click event
How do you display the message?
- the message is displaying but the link does not work
- the messages dissapears after the click event
How do you display the message?
ASKER
i am displaying the <div> section of dmessages in the Deafult.aspx.cx file as
string msg=DisplayMessage();
dMessages.Controls.Add(add Message(ms g, 1));
the body of add message method is this:
private Label addMessage(string message, int severity)
{
Label label = new Label();
string css = "message";
if (severity == 0) css += " success";
else if (severity == 1) css += " warning";
else if (severity == 2) css += " error";
else css += " information";
css += " close";
label.CssClass = css;
label.Text = message;
return label;
}
string msg=DisplayMessage();
dMessages.Controls.Add(add
the body of add message method is this:
private Label addMessage(string message, int severity)
{
Label label = new Label();
string css = "message";
if (severity == 0) css += " success";
else if (severity == 1) css += " warning";
else if (severity == 2) css += " error";
else css += " information";
css += " close";
label.CssClass = css;
label.Text = message;
return label;
}
ASKER
Fixed it. The link is working Thank you for the help
I needed to comment out "css+="close""
I needed to comment out "css+="close""
ASKER