473,471 Members | 4,650 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

How to use a dynamic text link as a post-back trigger?

I have a form that has a 'sub-form' in it that updates a separate table.

I can easily add records to this table from within this page. To delete,
though, I've been redirecting to a different 'delete' page where it asks for
confirmation before deleting. This works, but the problem is that I loose my
postback information from the main page. Since this is just a small bit of a
larger form, I don't want people to fill out half the form, get to this
point, delete an item, only to see the rest of their form reset.

So...

I decided that the confirmation isn't really that necessary for this, since
it's just a relationship I'm deleting...not the actual record. As such, I
want to delete the item from this page.

The question is how to I create these dynamic 'delete' links? Here's how I
currently do it:

(larger part of form)

item 1 | delete
item 2 | delete
item 3 | delete

these delete links are in a repeater and I build them one by one as such:

a href="deletepage.aspx?itemToDelete=[itemID]

So, I'm passing a specific field with each link to a new page.

Is there a way I can make these dynamicly rendered links (or buttons, if
need be) postback triggers? If so, how can I dynamically attach the itemID
to each one?

-Darrel
Nov 19 '05 #1
1 1448
Darrel, I'm not highly familiar with the capabilities of the Repeater
control, so I don't know whether there is a way to easily render a
LinkButton-type control in your current approach.

However you can definately emulate this behavior in a DataGrid, which seems
more appropriate for what you're doing.

In that approach, you would have a Delete link per row, which on click would
do a postback instead of a link to another page. Since you're not leaving
the page you don't lose your view state, and you can still do the delete
operations ad-hoc.

Another approach is to programmatically render your UI using a Table and
embedding TableRow's, TableCell's, LinkButton's, etc. This is nice for
especially complex UI's but in your case I would guess that the DataGrid is
the best solution.

/// M
"darrel" <no*****@hotmail.com> wrote in message
news:Ow**************@TK2MSFTNGP10.phx.gbl...
I have a form that has a 'sub-form' in it that updates a separate table.

I can easily add records to this table from within this page. To delete,
though, I've been redirecting to a different 'delete' page where it asks for confirmation before deleting. This works, but the problem is that I loose my postback information from the main page. Since this is just a small bit of a larger form, I don't want people to fill out half the form, get to this
point, delete an item, only to see the rest of their form reset.

So...

I decided that the confirmation isn't really that necessary for this, since it's just a relationship I'm deleting...not the actual record. As such, I
want to delete the item from this page.

The question is how to I create these dynamic 'delete' links? Here's how I
currently do it:

(larger part of form)

item 1 | delete
item 2 | delete
item 3 | delete

these delete links are in a repeater and I build them one by one as such:

a href="deletepage.aspx?itemToDelete=[itemID]

So, I'm passing a specific field with each link to a new page.

Is there a way I can make these dynamicly rendered links (or buttons, if
need be) postback triggers? If so, how can I dynamically attach the itemID
to each one?

-Darrel

Nov 19 '05 #2

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

Similar topics

5
by: adrian | last post by:
hi all this is my first post to this group, so pls bear with me while i try to make some sense. i am trying to create a sproc which uses dynamic sql to target a particuar table eg. '.' and...
1
by: Macamba | last post by:
Hi all, I am currently developing a website for a voluntary organisation. It is my first step in website development. The dynamic menu I developed has some bugs, which I addressed in another...
3
by: Aaron Gervais | last post by:
I am brand-new to javascript, but after reading some tutorials online I was able to make a dynamic HTML photo gallery in javascript. It works fine in all browsers except IE6 (big surprise). I've...
3
by: JOSEPHINE ALVAREZ | last post by:
I have this code that I want to use to do a rollover. However, because the company I am doing it for is continually changing the text, I want to be able to use dynamic text to change the text on...
6
by: MikeY | last post by:
Hi Everyone, Does anyone know where I can get my hands on a sample with source code of a simple dynamic button control in C# Windows form. I am looking for a sample that uses a class library...
6
by: 35th Ave Media | last post by:
Hello, I have about 60+ pages that I need to insert a MAILTO: tag so people can email the page using their email client. The body of the message is going to be the URL of that page. Using ASP,...
6
by: Andrew Robinson | last post by:
I have a page that contains a number of link buttons that are used for making selections. I load my LinkButtons during the Page_PreInit event and they render fine but then I need to make a change...
1
by: Satish.Talyan | last post by:
hi, i want to create a dynamic tree hierarchy in javascript.there are two parts in tree, group & user.when we click on group then users come under that's tree category will be opened.problem is...
9
by: dli07 | last post by:
Hello, I'm trying to convert a piece of code that creates a dynamic vertical resizing bar in a table from internet explorer to firefox. It's based on a post from...
2
by: David W | last post by:
I need to include a style sheet link in the aspx page based on what user they are. Basically this functionality, but using code behind. Any idea how to change this line to code behind? This...
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...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
1
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...
0
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...
0
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...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
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 ...

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.