468,110 Members | 1,885 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,110 developers. It's quick & easy.

How to dynamically hide and show rows in a formview using javascript

Dear all,

I have a formview in which i have a DropDownList for selecting languages...there is also a add more button which when clicked shows 5 more dropdownlists so the user can select more langauges....

i have worked everything out....i made 5 additional rows below the languages DDList and set them to runat="server" and then i find these rows using the FormView1.FindControl method and make them Visible=false in the FormView1_PreRender() function...i use a session varaiable to keep track of the times the add more language button was clicked...

when clicked the page is postback and basically everything works.....but i have a form view there is a lot of datbase access going on and then it takes a lot of time...so i wanted to use javascript so that these rows can be made visible without reloding the page again.....

i dont know javascript much so i please guys if u could point me in the right direction it would be much appreciated
Feb 16 '09 #1
3 4192
9,735 Expert Mod 8TB
Are there a fixed number of additional rows that that they can add?
Feb 18 '09 #2
thanks for your time

one dropdownlist is displayed and the user can show upto five additional rows...making a total of 6....that means 6 postbacks.....

i found a trick on http://mattberseth.com/blog/2007/07/...nels_with.html which tells how one can lazy load the tabs but i am having a problem in it as well..which i have posted in the JAVASCRIPT/AJAX section.....even so if only one tab loads even so i was wishing javascript would allow me to show more dropdownlists without server roundtrips....

Feb 19 '09 #3
9,735 Expert Mod 8TB
This is possible.

Load all of the rows as normal and then use a JavaScript function to hide or display them according to what has been selected in the DropDownList.
You will have to somehow indicate to the JavaScript which rows to hide...so you can use a HiddenField, or create a JavaScript Array to store/pass the ClientIDs of the rows to the JavaScript function....Or you could use JavaScript to traverse through the HTML generated for FormView to locate the appropriate rows.

I don't understand what tabs have to do with hiding and displaying rows in a formview though?
Feb 19 '09 #4

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

3 posts views Thread by Harry | last post: by
19 posts views Thread by dmiller23462 | last post: by
10 posts views Thread by oLE | last post: by
12 posts views Thread by Jerad Rose | last post: by
11 posts views Thread by jimstruckster | last post: by
1 post views Thread by Solo | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.