I have text box and beside to it I have a linkbutton showing the link that is present in the text box. I am getting the URL from the website into the text from database.I need to open the link button in a new browser window.
aspx page
ASP.NET Syntax (Toggle Plain Text)
<asp:Label ID="lblBusinessURL" runat="server" Text="Label"></asp:Label> <asp:LinkButton ID="lnkBusinessURL" runat="server" ></asp:LinkButton>
aspx.cs page
ASP.NET Syntax (Toggle Plain Text)
string businessurl; businessurl = DSabc.Tables[0].Rows[0]["BusinessURL"].ToString(); if (businessurl.Contains ("http://")) { lblBusinessURL.Text = "<a href=" + businessurl + ">" + businessurl + "</a>"; } else { lblBusinessURL.Text = "<a href=http://" + businessurl + ">" + businessurl + "</a>"; }
No comments:
Post a Comment