User Name Password Register
DaniWeb IT Discussion Community
All
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
Reply
Join Date: Jul 2007
Posts: 7
Reputation: genpopo is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
genpopo's Avatar
genpopo genpopo is offline Offline
Newbie Poster

How to put procedures in a dynamic input button?

  #1  
Oct 5th, 2007
Hi! I have a problem on my program.. I created a dynamic button which i created during runtime and im done with that.. My problem is i dont know how to put codes in that button which i created dynamically. When i click the button i want to display an aspx page. Help me guys..
AddThis Social Bookmark Button
Reply With Quote  
Join Date: May 2006
Location: Bellevue, WA
Posts: 1,548
Reputation: Infarction has a spectacular aura about Infarction has a spectacular aura about Infarction has a spectacular aura about 
Rep Power: 8
Solved Threads: 51
Sponsor
Infarction's Avatar
Infarction Infarction is offline Offline
Battle Programmer

Re: How to put procedures in a dynamic input button?

  #2  
Oct 5th, 2007
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.
Reply With Quote  
Join Date: Feb 2005
Location: Braintree, UK
Posts: 1,166
Reputation: hollystyles will become famous soon enough hollystyles will become famous soon enough 
Rep Power: 7
Solved Threads: 59
hollystyles's Avatar
hollystyles hollystyles is offline Offline
Veteran Poster

Re: How to put procedures in a dynamic input button?

  #3  
Oct 5th, 2007
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);

:
:
==========================================
Yadda yadda yadda...
Web junky, fevered monkey
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

DaniWeb ASP.NET Marketplace
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes

Similar Threads
Other Threads in the ASP.NET Forum

All times are GMT -4. The time now is 4:37 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC