•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the ASP.NET section within the Web Development category of DaniWeb, a massive community of 456,533 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,886 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our ASP.NET advertiser: Lunarpages ASP Web Hosting
Views: 976 | Replies: 2
![]() |
•
•
Join Date: May 2006
Location: Bellevue, WA
Posts: 1,548
Reputation:
Rep Power: 8
Solved Threads: 51
Assuming that your button is on one page and you want to link to another, you can just set the PostBackUrl attribute to your destination:
<asp:Button ID="Button1" runat="server" PostBackUrl="someotherpage.aspx" Text="foo" />
Last edited by Infarction : Oct 5th, 2007 at 12:18 pm.
•
•
Join Date: Feb 2005
Location: Braintree, UK
Posts: 1,166
Reputation:
Rep Power: 7
Solved Threads: 59
OP is creating it dynamically so do Infarction's suggestion but in your code behind wherever you are building it.
using System.Web.UI.WebControls.
:
public partial class ... blah
{
private void Page_Load(object sender, System.EventArgs e)
{
// Put user code to initialize the page here
Button btn = new Button();
btn.ID = "button1";
btn.PostBackUrl = "somepage.aspx";
Page.Controls.Add(btn);
:
:![]() |
•
•
•
•
•
•
•
•
DaniWeb ASP.NET Marketplace
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
- Forms: styling text fields with CSS and HTML (Web Design Tutorials)
- Need help with Javascript (JavaScript / DHTML / AJAX)
- Button Binding Question: (Python)
- Print button using rollover images (JavaScript / DHTML / AJAX)
- request.form is not working in asp.net (ASP.NET)
- Clearing input (C)
- input from file into class (C++)
- Passing data from forms from one page to another (JavaScript / DHTML / AJAX)
Other Threads in the ASP.NET Forum
- Previous Thread: Can we put 2 buttonlink in only 1 page
- Next Thread: Format GridView Columns



Linear Mode