This is a migrated thread and some comments may be shown as answers.

Tabstrip Multipage RenderSelectedPageOnly

2 Answers 114 Views
TabStrip
This is a migrated thread and some comments may be shown as answers.
GDPR_erased
Top achievements
Rank 1
GDPR_erased asked on 16 Oct 2008, 04:05 PM
I have a problem with saving data. I have a tabstrip that is set to AutoPostBack and a Multipage set to RenderSelectedPageOnly.
I have a datalist on the first tab, and a datalist on the second tab.
When I  "Save" the data, I iterate through the first datalist (each item in the list) which is always rendered because it is on the first tab, then I iterate through each item in the second datalist which is on the second tab.
The problem is that if the user has not clicked on the second tab, the second datalist is not fully rendered somehow, so no items are collected and saved.
There is a little more detail. Obviously, if the user clicks on the second tab for the very first time, all the data is saved. It is only when the user opens the page again to edit, and never clicks on the second tab.
What I need to know is:
What is the best way to tell if the datalist on the second tab has been fully rendered? Or do I have to keep up with what tabs are clicked? I had rather just skip the routine to save the data on the second datalist if I could only tell if it was not there or rendered fully.
Thanks,
~bg

2 Answers, 1 is accepted

Sort by
0
Serrin
Top achievements
Rank 1
answered on 16 Oct 2008, 04:47 PM
Hey bg,

Hmm, not sure what logic you're using to save the datalist, but I had a similar problem with doing a database request and then using that data for a report on the page.  Since I'm not quite an expert yet, my simple solution was to do a little check on the .count() on my returned info.  If it was > 0, then I know I have data there, otherwise I can safely assume that there is no data to use.

Not sure if that would work for your scenario or not, but I thought I'd put it out there.
0
GDPR_erased
Top achievements
Rank 1
answered on 16 Oct 2008, 05:15 PM
Thanks for the suggestion, but unfortunately, that is what I am doing, but if the control has not rendered, there are never any items to count. The control itself is there, it is instantiated, but not rendered. If I said that correctly?
What I have found as a workaround, is, I put a HiddenContol on the pageview that coresponds to the tab and set its value at "0". Since the tabstrip is autopostback, I set the hidden field to "1" if the tab is selected.
Then, when I go thru my routine to save the data, I check to see if the hidden control is set to 1, if so, I save the records.

What makes this unique is that  (for the rest of the story), I'm really, deleteing all the records first, then saving them again. therefore, the records get deleted, but never saved again unless they clicked on the tab and actually rendered the control. Now, with the hidden control, I can delete the records and save them only if the hidden value is set to "1" for each corresponding tab.
Thanks,
~bg
Tags
TabStrip
Asked by
GDPR_erased
Top achievements
Rank 1
Answers by
Serrin
Top achievements
Rank 1
GDPR_erased
Top achievements
Rank 1
Share this question
or