dymanic <asp:button> shenanigans

G

Guest

Hi folks,
first off, I'm using Framwork 1.1 with ASP.net and C#

I'm trying to do something quite basic and can't figure out why it won't
behave
without going into massive details I want a button on an .aspx page have
either a 'save' caption and 'save' commandname or a 'close' caption and a
'close' commandname
The caption necessity is obvious, but the commandname is important to
because the event stub that is tied to that button (just by double-clicking
the 'neutral' button in the designer window) then checks the command name and
decides what to do

in the non postback portion of the page_load, I have code that sets up the
button properties the first time (i.e not on postback).

now inside the event stub you could say
Switch case commandname etc...
if it's close do close stuff and if it's save do save stuff

however I can't figure out a way to do this dynamically from a database
table coming into a dataTable and somehow keep this information saved in the
button during every subsequent postback for that user.

hence my question in a nutshell is:
Essentially I have a button that is getting its commandname and text
properties from a database, but it forgets what they are on every postback,
is there a way of dynamically setting these asp:button properties and having
the button remember them for the lifetime of the use of the page (for that
user), I know about using a session object, but is there some more automatic
way (i.e a feature) to make it remember it's properties as viewstate doesn't
seem to do it.



Regards and thanks in advance,
CharlesA
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,794
Messages
2,569,641
Members
45,353
Latest member
RogerDoger

Latest Threads

Top