Solved

dynamic button how to assign different events

Posted on 2008-10-22
1
223 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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

Introduction This article shows how to use the open source plupload control to upload multiple images. The images are resized on the client side before uploading and the upload is done in chunks. Background I had to provide a way for user…
This article shows how to deploy dynamic backgrounds to computers depending on the aspect ratio of display
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

856 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