Featured post

c# - Usage of Server Side Controls in MVC Frame work -

i using asp.net 4.0 , mvc 2.0 web application. project requiremrnt have use server side control in application not possibl in noraml case. ideally want use adrotator control , datalist control. i saw few samples , references in codepleax mvc controllib howwver found less useful. can tell how utilize theese controls in asp.net application along mvc. note: please provide functionalities related adrotator , datalist controls not equivalent functionalities thanks in advace. mvc pages not use normal .net solution makes use of normal .net components impossible. a normal .net page use event driven solution call different methods service side mvc use actions , view completly different way handle things. also, mvc not use viewstate normal .net controlls require. found article discussing mixing of normal .net , mvc.

asp.net - Proper way to populate dropdownlist based off another value? -


i'm running minor issue asp.net code i'm working on. simplicity sake lets have 2 dropdownlists, 1 full of various items , full of other items, based off selected item of first dropdownlist. set variables hidden inputs check see if item in first dropdownlist has changed , if has change second dropdownlist, i'm having check make sure if else causes postback not repopulate second dropdownlist not lose selected user. check allows me make sure when navigate away page, correct values selected , not replaced postback repopulation.

i'm new asp.net/html/css/javascript , like. know while have works, isn't close being correct way things. please me correct ways , figure out best way solve current problem. asp.net tutorial websites nice need keep improving skills it.

try autopostback true selected index changed event:

<asp:dropdownlist id="dropdownlist1" autopostback="true" onselectedindexchanged="dropdownlist1_selectedindexchanged" runat="server" /> <asp:dropdownlist id="dropdownlist2" runat="server" /> 

and have event populate second dropdown:

protected void dropdownlist1_selectedindexchanged(object sender, eventargs e) { } 

edit if need populate first page load following, or better still make method called both page load , selected index changed populate dropdown.

if (!page.ispostback) {    dropdownlist1_selectedindexchanged(dropdownlist1, eventargs.empty); } 

Comments

Popular posts from this blog

c# - Usage of Server Side Controls in MVC Frame work -

cocoa - Nesting arrays into NSDictionary object (Objective-C) -

ios - Very simple iPhone App crashes on UILabel settext -