473,785 Members | 2,290 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

dymanic <asp:button> shenanigans

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

Mar 24 '06 #1
1 1267
Have you tried using the button's CommandArgument property?


"CharlesA" <Ch******@discu ssions.microsof t.com> wrote in message
news:62******** *************** ***********@mic rosoft.com...
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

Mar 24 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
2181
by: RSB | last post by:
Hi Every one, Having tuff time to make this work .. i want to have a button and on my form say Delete button. So once i click on it i want to confirm "Are you sure?" on the Client Side and if client select "Cancel" then i want to ignore the action and if "OK" selected then i want to Execute a Server side Event or Procedure. Now what is happening here is for "Delete1" button (in my code) even if Client Select Cancel it is still...
0
1630
by: Drew Pawlik | last post by:
Hey guys, I'm having a problem and need some help. I have an <asp:table ...> in my web page, and this table has 2 rows, the first being a header row, and the second row containing an <asp:button> to add rows to the table. Well, when I add the first row it shows up, but if I try to add any more rows, the one I added + the rest of them all disappear. I tried saving the table to a Session variable, but that didn't work. I'm not really sure...
4
2288
by: z. f. | last post by:
Hi, I'm having an aspx page with a server form. i have a grid with a delete button and below the grid, another area with inputs for inserting new values and an "add" button for submiting the lower area of the form. on the lower area i have validators for validating input.
4
2018
by: z. f. | last post by:
Hi, i stated that this is an advanced question because i have a post from few days ago that i received answers to with suggestions that looked good but did not work, so please if you post a reply make sure your suggestion actually works. like a <asp:button> control have a CausesValidation property that allows it to POST a button command event to the server without causing the page to make validation on form inputs, i need to get the...
2
4081
by: Ed Chiu | last post by:
Hi, I would like to add a <asp:button> to a webform. When user click on this button, the page will connect to SQL server and update tables, then the browser window will be closed. I know how to connect to SQL server and update tables but I don't know how to close browser window after that. The SQL server part is on the server side, closing window is on client side.
2
6915
by: Dee | last post by:
Hi I have to <asp:button>'s one on top of the other in a cell of a Table layout. When I put a <br> I get too big a gap. Without it they are touching. The only way I can think of separating them is if I make another table inside that cell and have a cellspacing that's suitable. But that sounds overkill. Anyone has solved this puzzle before? Thanks for sharing. Dee
13
7449
by: tperri | last post by:
I have an HTML table with several fields like this: <A href="Savings.aspx?category=Food"><asp:imagebutton id="imgFood" ImageUrl="images\buttons\btn-food-i.gif" runat="server"></asp:imagebutton></A> When the user sees these buttons, they will currently be on the savings.aspx?category=whatever page, and when they click another button to look at other categories, all the links I have around these buttons direct to their various categories.
11
7764
by: Joe | last post by:
Hello All, I have an ASP.NET page with one Textbox (SearchTextBox) and one ImageButton (SearchButton) server controls. The user can type search text in SearchTextBox and click SearchButton and the web server performs a database query and displays the results. All of this works fine. I want the user to be able to press the Enter key while the cursor is still in SearchTextBox and have the SearchButton.Click event fire (thus performing...
1
3437
by: FredZimmerman | last post by:
How do I dynamically generate <ASP:buttoncontrols for a repeating recordset (using reader with while loop). Each row would have ASP:Button and CommandName="sameFunctionForAll()" CommandArgument=reader.ToString() I'm not at all sure how to tackle this. I have page that contains embedded .ASCX. The buttons would be displayed within the embedded web user control.
0
9646
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9957
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8983
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7505
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6742
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5386
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4055
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3658
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2887
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.