Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > How to use a dynamic text link as a post-back trigger?

Reply
Thread Tools

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

 
 
darrel
Guest
Posts: n/a
 
      01-27-2005
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


 
Reply With Quote
 
 
 
 
MWells
Guest
Posts: n/a
 
      01-28-2005
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" <(E-Mail Removed)> wrote in message
news:OwD#(E-Mail Removed)...
> 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
>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Customize TreeNode of TreeView as a composite of dynamic text and link. zlf ASP .Net 0 08-20-2007 08:17 AM
Dynamic text: modify text by image/link click David Housman Javascript 1 02-02-2007 10:41 AM
RE: Link Link Link =?Utf-8?B?REw=?= Windows 64bit 0 05-17-2005 12:15 PM
Re: Link Link Link DANGER WILL ROBINSON!!! Kevin Spencer ASP .Net 0 05-17-2005 10:41 AM
Click link in popup window and insert link text in a field of mother window BlueŽ Javascript 4 09-27-2003 05:18 PM



Advertisments