Solved

Replace Hyperlink with "asp:Button" Functionality

Posted on 2007-12-05
1
1,054 Views
Last Modified: 2012-08-14
I need to replace the two attached code snippets with asp:buttons instead of an <a href> tag but still maintain the functionality:

These do 2 simple processes:

1- a hyperlink to close the current window
2- a hyperlink to pass a querystring to another web page url

Can anyone help?

<asp:TableRow runat="server">

                <asp:TableCell ID="TableCell1" HorizontalAlign="left" runat="server">

                <a href="ContactBookForm.aspx?CID=-1">Add New</a>

				</asp:TableCell>

				<asp:TableCell runat="server">

                    <a href="javascript:window.close();">Close Window</a>

				</asp:TableCell>

            </asp:TableRow>

Open in new window

0
Comment
Question by:jtrapat1
1 Comment
 
LVL 1

Accepted Solution

by:
dabrat earned 125 total points
ID: 20419629
hello, you could just create the buttons and add code to the Click events like below --

  protected void Button1_Click(object sender, EventArgs e)
        {
            string url = "PageTwo.aspx?CD-1"; // pass a querystring to another web page url
            Response.Redirect(url);
        }

        protected void Button2_Click(object sender, EventArgs e) // closes window
        {
            Response.Write("<script language='javascript'> { self.close() }</script>");
        }


HTH
0

Featured Post

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

This demonstration started out as a follow up to some recently posted questions on the subject of logging in: http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/Q_28634665.html and http://www.experts-exchange.com/Programming/…
Any business that wants to seriously grow needs to keep the needs and desires of an international audience of their websites in mind. Making a website friendly to international users isn’t prohibitively expensive and can provide an incredible return…
Viewers will get an overview of the benefits and risks of using Bitcoin to accept payments. What Bitcoin is: Legality: Risks: Benefits: Which businesses are best suited?: Other things you should know: How to get started:
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…

864 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now