473,386 Members | 1,734 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

selecting value via dynamicaly created list of buttons

Hi,

to allow my user to select from a list of values which are calculated on
the fly, I tried to generate a list of LinkButton controls on the fly.
But the connected event does not fire.

Searching google I found out that the problem is caused by the structure
of the ASP.Net event handling: The clicked button does not exist anymore
after the postback, so no event could be fired.

Does anybody know a simple workaround?

My requirements are quite simple:

I want to write a control which display a list of options. In classic
ASP I would do something like (for example generated out of a database):

<a href='page.asp?selection=aaa'>aaa</a><br>
<a href='page.asp?selection=bbb'>bbb</a><br>
<a href='page.asp?selection=ccc'>ccc</a><br>
<a href='page.asp?selection=ddd'>ddd</a><br>
....

And in the page:

var selection = Request("selection");

How can I do something like this in ASP.Net?

regards,
Achim
Nov 19 '05 #1
2 1268
Hi Achim,
Does anybody know a simple workaround?
one way to do it, is to recreate the exact same page you send to the client
again. That way the events can fire.
Afterwards you can call yourself again to load a new page for the client.
What you will need to do, is create a boolean in your session to tell
yourself if this time you are calling yourself, or the client is calling you
so you know if you should restore the last page, and react to the events.

My requirements are quite simple:

I want to write a control which display a list of options. In classic ASP
I would do something like (for example generated out of a database):

<a href='page.asp?selection=aaa'>aaa</a><br>
<a href='page.asp?selection=bbb'>bbb</a><br>
<a href='page.asp?selection=ccc'>ccc</a><br>
<a href='page.asp?selection=ddd'>ddd</a><br>
...


Of course you can also just do it the good old asp way, and actualy create
those Hyperlinks to youself and then check Request.QueryString if any of
them were used.
Hope this helps
Johannes
Nov 19 '05 #2
Johannes Hammersen wrote:
one way to do it, is to recreate the exact same page you send to the client
again. That way the events can fire.
Afterwards you can call yourself again to load a new page for the client.
What you will need to do, is create a boolean in your session to tell
yourself if this time you are calling yourself, or the client is calling you
so you know if you should restore the last page, and react to the events.
That's no option. The date required to rebuild the page would be to
expensive to calculated and I don't want to store it.
Of course you can also just do it the good old asp way, and actualy create
those Hyperlinks to youself and then check Request.QueryString if any of
them were used.


The control will be part of a SharePoint Webpart and I don't know how
this solution would interact with SharePoint.

If found another solution: I generate the links as <a href> Tag, using
GetPostBackClientHyperlink to generate the href. The creating control
handles the postback and generates the appropriate event.

regards,
Achim
Nov 19 '05 #3

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

Similar topics

4
by: Shufen | last post by:
Hi, I'm a newbie that just started to learn python, html and etc. I have some questions to ask and hope that someone can help me on. I'm trying to code a python script (with HTML) to get...
9
by: Ant | last post by:
Hi, I'm new to .NET, though program with VB. I'm used to selecting an event from the right side drop down box of the VB IDE. That seems to have changed with ..NET. How do you choose an event, say...
3
by: james.dixon | last post by:
Hi I was wondering if anyone else had had this problem before (can't find anything on the web about it). I have three select elements (list boxes - from here on I'll refer to them as 'the...
1
by: MarkPtacek | last post by:
Objective: Have a manager select a user's ID from a list and have a report generated based on the user that is selected. Current Progress: I have created a run-time prompted query and based a...
3
by: leon | last post by:
hello friends, i am writing a page aspx and creating controls dinamicaly and then i must to create for each control the events as well. Anybody to know how????? happy day lion
2
by: Bisser Milanov | last post by:
I add radio buttons created dynamically in a datagrid on each row of the grid. When I see the generated HTML I see that in front of each name for a radio button is added: name="_ctl0:_ctl1:_ctl3:...
2
by: Rob | last post by:
Hi all, I've got multiple sets of radio button that are dynamically created in code and populated by a database query. The query returns about 20 recordsets with 3 radio buttons per recordset and...
6
by: Totto | last post by:
Hi, Anyone know the best solution to dynamically add buttons to a asp 2.0 page using data from Sql server? Are there any contols suitable for this or is it best to iterate the dataset and...
4
by: darrel | last post by:
I have a DDL list along these lines: item value="1" text="a" item value="2" text="b" item value="3" text="c" item value="2" text="d" item value="2" text="e" item value="1" text="f" item...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.