Label in a Repeater affecting Javascript performance

G

Guest

I've a big problem that I don't know how to solve for quite long. In one of
my aspx file, I have a form that run at server. Within this form, there's a
table. The first row is made up of some text boxes and a submit button. The
remaining rows are made up of a data repeater, that display items that are
previously inserted into the table. Its structure is just like a shopping
cart table, whereby the first row you can add a new item, while the remaining
rows are items that you've already added.

I've 3 labels placed in the repeater to show generic information of the
item. So these 3 labels will just repeat itself in the form with the same id.
This, I believe is the main source of my problem. Because when there are too
many labels with the same id in the same form, when I press the submit
button, it will just check the javascript and after that i doesn't really do
what it is supposed to do, i.e. inserting the new data to the table.

I think I'm not really making myself very clear here. Just treat it as if
like a shopping cart, and the bottom few rows I have labels of the same id.
How can I solve this so that when I click the submit button, it will not only
check the javascript but also proceed with the On Click codes (the one that
runs in the server)?

Which means now, because I have labels placed in a repeater, the form has
many labels with the same id (which I believe is the problem). So it goes
haywire, and only do the client side processing, and forget about the server
side.

Thank you in advance.
 
K

Karl Seguin

I don't think you are right about why you are having problems. First off,
the controls don't have the same rendered ids. If you go view source,
you'll see each <span id="xxxx"> is different because they are automatically
generated.

Some thoughts:

(a) From how you describe the system, the viewstate of your repeater could
be turned off, try turning it off and see if the problem persists
(b) You could try to use Literal's instead of label, which means you'll
lose some control (such as specifying styles), but it should make your page
lighter and not render any ids.


I'm not clear what javascript is running tha tyou are talking about? Is
there client-side validation for the first row? (if so, try disabling it).

Karl

--
MY ASP.Net tutorials
http://www.openmymind.net/ - New and Improved (yes, the popup is
annoying)
http://www.openmymind.net/faq.aspx - unofficial newsgroup FAQ (more to
come!)
 
G

Guest

I'm not clear what javascript is running tha tyou are talking about? Is
there client-side validation for the first row? (if so, try disabling it).

Thanks. I'll try. The javascript I mentioned was doing some client-side
validation on the first row. Checking that the user had key in integers for
quantity and date of the right format and etc.
 
G

Guest

(a) From how you describe the system, the viewstate of your repeater could
be turned off, try turning it off and see if the problem persists

By the way how do I turn off a viewstate? What is a viewstate?

Thanks again, I'll try.
 
K

Karl Seguin

Check out:
http://www.takempis.com/aspnet_fundamentals.asp

You can disable it by doing enableViewState="false" in your repeater
(<asp:repeater enableViewState="false" ...>)

note that disabling it might break some other stuff which relies on
viewstate being enabled...from your brief description I don't think that's
the case, but I could easily be wrong.

karl

--
MY ASP.Net tutorials
http://www.openmymind.net/ - New and Improved (yes, the popup is
annoying)
http://www.openmymind.net/faq.aspx - unofficial newsgroup FAQ (more to
come!)
 

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,995
Messages
2,570,236
Members
46,822
Latest member
israfaceZa

Latest Threads

Top