Solved

Replace Hyperlink with "asp:Button" Functionality

Posted on 2007-12-05
1
1,055 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

Read about why website design really matters in today's demanding market.
I've been asked to discuss some of the UX activities that I'm using with my team. Here I will share some details about how we approach UX projects.
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.

832 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