4 Replies - 1816 Views - Last Post: 27 August 2012 - 07:34 PM Rate Topic: -----

#1 November-06  Icon User is offline

  • D.I.C Regular

Reputation: 46
  • View blog
  • Posts: 395
  • Joined: 04-January 11

RadioButton SelectedIndexChanged Performance

Posted 22 August 2012 - 01:19 AM

I have a radiobuttonlist which AutoPostback property I set to true since it does something on selectedindexchanged.

When postback occurs, multiple tables are retrieved to get 6 different datasources for my dropdownlists in the page.

The approximate total number of rows of the 6 tables are about 800 to 900. Depending on how much the user uploads, they can contain more than thousands of rows.

I need the selectedindexchanged event since option A will have different records from option B.

I tried the following...

1. I queried all the rows containing both option A and option B. I added a column (eg. TYPE) as indicator if it is for option A or B. Then in my program, I store it in a viewstate. When the selectedindexchanged event is fired, I store the viewstate in a dataview and filter it by the value of the radio button which checked property is set to true. So if option A is selected, all rows with type A is filtered in the dataview and that dataview is used as the datasource for one of my dropdownlists. Other dropdownlists do not need filtering.

2. I also tried calling roundtrips to server on every postback caused by selectedindexchanged. So once the event is fired, I call the stored procedure sending data whether to query for rows for option A or B.

3. I also tried, querying option A and B together but storing them at different tables. When it is retrieved with a dataset, each tables are stored in different viewstates.

Okay, my problem is this... it takes a lot of time. In localhost, it only takes about 2 to 3 seconds to load after every postback caused by the selectedindexchanged event but when I published it to the server, it takes 10 to 12 seconds which can make the user impatient. Imagine that you need to wait for that much time just because you changed the selected radio button. It really sucks.

So my problem mainly lies on how I can improve performance. Should I try different approach in loading tables as datasource every time radiobutton is selected?

I have read that large data stored in a viewstate can slow down the page.

This post has been edited by November-06: 22 August 2012 - 01:27 AM


Is This A Good Question/Topic? 0
  • +

Replies To: RadioButton SelectedIndexChanged Performance

#2 Nakor  Icon User is offline

  • Professional Lurker
  • member icon

Reputation: 444
  • View blog
  • Posts: 1,492
  • Joined: 28-April 09

Re: RadioButton SelectedIndexChanged Performance

Posted 22 August 2012 - 04:17 AM

Are you saying that each of these DropDownLists can have over 1000 items to choose from?
Was This Post Helpful? 0
  • +
  • -

#3 November-06  Icon User is offline

  • D.I.C Regular

Reputation: 46
  • View blog
  • Posts: 395
  • Joined: 04-January 11

Re: RadioButton SelectedIndexChanged Performance

Posted 22 August 2012 - 06:35 PM

No. 2 of the dropdownlists have less than 50. 1 can have around 100. Another can have around 200. While the remaining 2 can have around 500 records.

If you are familiar with obout tools, I am actually using its comobobox. Others are just simple comoboxes while others are grid-like comoboboxes to show detailed description.

But irregardless of the obout tools, what do you think is the best way to improve performance?
Was This Post Helpful? 0
  • +
  • -

#4 eclipsed4utoo  Icon User is offline

  • Not Your Ordinary Programmer
  • member icon

Reputation: 1524
  • View blog
  • Posts: 5,960
  • Joined: 21-March 08

Re: RadioButton SelectedIndexChanged Performance

Posted 27 August 2012 - 06:56 PM

What are your queries? Are you doing a "SELECT *" and only using 2 fields? Have you thought about indexes on the database tables? Your issue is obviously DB performance or how your code is interacting with the database. I've written plenty of web apps that return 1000s of records in just a few seconds.
Was This Post Helpful? 1
  • +
  • -

#5 Nakor  Icon User is offline

  • Professional Lurker
  • member icon

Reputation: 444
  • View blog
  • Posts: 1,492
  • Joined: 28-April 09

Re: RadioButton SelectedIndexChanged Performance

Posted 27 August 2012 - 07:34 PM

I'd look at optimizing an queries as eclipsed4utoo suggests. I'd also try to limit the number of results if at all possible. I don't know how you're loading your controls but make sure that on any postback events that you are only reloading the necessary data and not the entire page. If it's at all possible look into caching the results so you don't have to hit the database a second time to get data that you've already loaded.
Was This Post Helpful? 1
  • +
  • -

Page 1 of 1