Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: .NET3.5 ASP.NET C#4.0
I have one form containing dropdownlist with 4 values in it fetching from database and have one button.
now on page load i have written coding for fetching data in dropdownlist and i am getting that and i select one value from it but when i click on button for "additional functionality" on it then dropdownlist also get refreshed(the value i selected is replaced by first value in dropdownlist...i tried of autopostback on button and too on dropdownlist but had no affect
.how can i stop this
pls tell
regards
Posted 7-Feb-13 1:29am

1 solution

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

Hi,
 

I guess you are loading your dropdown in all the pageloads, irrespective of whether its a post back or not.
You can load your dropdown only if its a initial page load and not a post back.
like,
 
if(!IsPostBack)
{
//then your code here
}
 
Hope this helps.
  Permalink  
v2
Comments
shivani 2013 at 7-Feb-13 7:42am
   
thanks.i have one more issue that i want when i click on particular item of i want its product cost should come in a given textbox .i am not able to achieve through ddlprd_selectedindexchange but same i can achieve on clicking button...y so ...how can i achieve through ddlprd_selectedindexchange ?
pls tell
regards
manognya kota at 7-Feb-13 9:12am
   
Once you fix this problem, you should be able to get the selected item in your index change.Can you post your code for the button click and the selected index change?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 OriginalGriff 304
1 Sergey Alexandrovich Kryukov 255
2 Shweta N Mishra 216
3 Maciej Los 210
4 PIEBALDconsult 174
0 OriginalGriff 7,660
1 Sergey Alexandrovich Kryukov 7,072
2 DamithSL 5,586
3 Manas Bhardwaj 4,946
4 Maciej Los 4,665


Advertise | Privacy | Mobile
Web02 | 2.8.1411023.1 | Last Updated 7 Feb 2013
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100