Solved

dynamic button how to assign different events

Posted on 2008-10-22
1
221 Views
Last Modified: 2008-10-22
I need to have one button on an asp.net web form.  The button text will be depend on the "customer status"

So if a customer is "pending" then the button text should be set to "approve customer"

Now I want to pass a variable of "approve" to the click event of this button.

Also if a customer is "approved"  I want button text to say "disapprove" and pass variable to onclick of this button variable "disapprove"

How can I do this?
0
Comment
Question by:mugsey
1 Comment
 
LVL 26

Accepted Solution

by:
Anurag Thakur earned 500 total points
ID: 22776546
when you are loading the data on the form you need to find out the customer status and set the text of the button accordingly
when you are setting the button text also set the command name property of the button which you can use to define what kind of action you need to take to handle the kind of situation
like approval or disapproval
http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.button.commandname(VS.80).aspx
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Error in page 3 46
Two different visual studio versions 3 23
Visual Studio TFS - how do I check in my code? 2 29
System.Speech 2 15
Problem Hi all,    While many today have fast Internet connection, there are many still who do not, or are connecting through devices with a slower connect, so light web pages and fast load times are still popular.    If your ASP.NET page …
This article shows how to deploy dynamic backgrounds to computers depending on the aspect ratio of display
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, just open a new email message. In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…

920 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

15 Experts available now in Live!

Get 1:1 Help Now