I have block of code adding values to dropdown list under
if (!Page.IsPostBack)
{
adding items
}
else
{
refreshing data
}
return
even I am checking !Page.IsPostBack, once its reaches to return, again it is
going to top of Page_Load event and executing true part of If block. So the
data is adding twice to the dropdown list.
One thing I do not understand is once the page is loaded, second time why
Page.IsPostBack is showing 'false'.
any help please, thanks in advance 5 2900
Tim,
You might want to set the combobox to not use viewstate to store it's
state, and rather, just populate the combobox every time you load the page.
You can cache the data for the list to make the operation faster as well.
Then, you can add items to the page based on the conditions that you
specify, and not the page state (which I don't think is a good model, to
base it on the page state, that is).
Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com
"Tim" <Ti*@discussions.microsoft.com> wrote in message
news:E7**********************************@microsof t.com... I have block of code adding values to dropdown list under
if (!Page.IsPostBack) { adding items } else { refreshing data } return
even I am checking !Page.IsPostBack, once its reaches to return, again it is going to top of Page_Load event and executing true part of If block. So the data is adding twice to the dropdown list.
One thing I do not understand is once the page is loaded, second time why Page.IsPostBack is showing 'false'.
any help please, thanks in advance
You mean that to set 'EnableViewState' property of the dropdownlist to
'false' I did that way, it did't help me out.
"Tim" wrote: I have block of code adding values to dropdown list under
if (!Page.IsPostBack) { adding items } else { refreshing data } return
even I am checking !Page.IsPostBack, once its reaches to return, again it is going to top of Page_Load event and executing true part of If block. So the data is adding twice to the dropdown list.
One thing I do not understand is once the page is loaded, second time why Page.IsPostBack is showing 'false'.
any help please, thanks in advance
hi,
probably you are not postng back the page, if you have for example a link to
the same page that is a new request , not a refresh of the old one, use a
LinkButton instead.
post this:
what is the element in the page that do the request?
could you post the code for both the true and false blocks?
cheers,
--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation
"Tim" <Ti*@discussions.microsoft.com> wrote in message
news:E7**********************************@microsof t.com... I have block of code adding values to dropdown list under
if (!Page.IsPostBack) { adding items } else { refreshing data } return
even I am checking !Page.IsPostBack, once its reaches to return, again it is going to top of Page_Load event and executing true part of If block. So the data is adding twice to the dropdown list.
One thing I do not understand is once the page is loaded, second time why Page.IsPostBack is showing 'false'.
any help please, thanks in advance
I guess some of your code refresh the page in " refreshing data" function.
This may lead to Page_Load twice.
And at the second time of page load, the Page.IsPostBack is exactly true
since the old page and new page are same..
"Tim" wrote: I have block of code adding values to dropdown list under
if (!Page.IsPostBack) { adding items } else { refreshing data } return
even I am checking !Page.IsPostBack, once its reaches to return, again it is going to top of Page_Load event and executing true part of If block. So the data is adding twice to the dropdown list.
One thing I do not understand is once the page is loaded, second time why Page.IsPostBack is showing 'false'.
any help please, thanks in advance
I can not post the code, it is huge. Apart from code do I need to set any
properties of page, control or config files. Please let me know.
"Ignacio Machin ( .NET/ C# MVP )" wrote: hi,
probably you are not postng back the page, if you have for example a link to the same page that is a new request , not a refresh of the old one, use a LinkButton instead.
post this:
what is the element in the page that do the request?
could you post the code for both the true and false blocks?
cheers,
-- Ignacio Machin, ignacio.machin AT dot.state.fl.us Florida Department Of Transportation "Tim" <Ti*@discussions.microsoft.com> wrote in message news:E7**********************************@microsof t.com...I have block of code adding values to dropdown list under
if (!Page.IsPostBack) { adding items } else { refreshing data } return
even I am checking !Page.IsPostBack, once its reaches to return, again it is going to top of Page_Load event and executing true part of If block. So the data is adding twice to the dropdown list.
One thing I do not understand is once the page is loaded, second time why Page.IsPostBack is showing 'false'.
any help please, thanks in advance This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: anonymous |
last post by:
Thanks Michelle,
How could I achieve the second one.I do not like Flashing windows in
response to selection of an item.
I agree the data transfer is very little but the same data transferred for...
|
by: Sam Kuehn |
last post by:
There has been a lot of articles on how to load user controls at runtime in the Init() method.
UserControl myControl = (UserControl)LoadControl(stringControl);
I add the control in the Init()...
|
by: Wysiwyg |
last post by:
I was hoping to get some opinions on the efficiency of various methods of
reusing the same dropdown list data.
Here is the situation:
Multiple panels on maintenance pages with TAB menus across...
|
by: Jack |
last post by:
Hello,
I have a dropdown list on a user control and the AutoPostBack property is
set to True. I want to use the SelectedIndexChanged event to populate some
text boxes based on what the user...
|
by: Chris |
last post by:
Hi,
I am wondering where in my ASP.NET application to load a dropdown list box
that
basically only changes once a year.
I load a drop down list box with about 40 locations. If it never...
|
by: Mike Collins |
last post by:
I cannot get the correct drop down list value from a drop down I have on my
web form. I get the initial value that was loaded in the list.
It was asked by someone else what the autopostback was...
|
by: muthu |
last post by:
Hi guys,
Iam using a repeator control in my page.In wich i have
dropdown list as the last column.I have a label in the first
column.Now i have binded a datable to the repeator in the page load...
|
by: docw |
last post by:
SelectionChangeCommitted event fires twice
Hi,
Please have a look at the following ComboBox behavior.
With the code below, if you click in the dropdown list with the mouse
to select an item ,...
|
by: tarscher |
last post by:
Hi all,
I have a gridview populated with data coming from a dataset (created
via the wizard). The data shown in the gridview is dependent on the the
choice of a control (dropdown with...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
| |