Click here to Skip to main content
15,904,153 members
Home / Discussions / C#
   

C#

 
QuestionOData 4 $InLineCount Pin
JoelPark28-Jul-14 10:58
JoelPark28-Jul-14 10:58 
AnswerRe: OData 4 $InLineCount Pin
OriginalGriff28-Jul-14 21:38
mveOriginalGriff28-Jul-14 21:38 
AnswerRe: OData 4 $InLineCount Pin
Kornfeld Eliyahu Peter28-Jul-14 22:20
professionalKornfeld Eliyahu Peter28-Jul-14 22:20 
GeneralRe: OData 4 $InLineCount Pin
JoelPark29-Jul-14 3:37
JoelPark29-Jul-14 3:37 
QuestionHow to retain Dropdownlist value after selectedindexchanged and postback?? Pin
lan160727-Jul-14 14:07
lan160727-Jul-14 14:07 
AnswerRe: How to retain Dropdownlist value after selectedindexchanged and postback?? Pin
Ron Nicholson28-Jul-14 4:48
professionalRon Nicholson28-Jul-14 4:48 
AnswerRe: How to retain Dropdownlist value after selectedindexchanged and postback?? Pin
Member 924543128-Jul-14 8:21
Member 924543128-Jul-14 8:21 
GeneralRe: How to retain Dropdownlist value after selectedindexchanged and postback?? Pin
lan160729-Jul-14 14:01
lan160729-Jul-14 14:01 
Thanks for your replies.. i tried your suggestion by storing the selectedindex of my second dropdownlist into session. i put a breakpoint on Loading event to see if the selectedindex value was stored but unfortunately it was not stored,it always stored the first value of my second dropdownlist.. here are some of my codes below

private void _getSection()
{
ddlSection.Datasource=_queries("StoredProc",ddlLevel.SelectedIndexChanged);
ddlSection.DataTextField ="SectionName";
ddlSection.DataValueField="id";
ddlSection.DataBind();
}

private void _loadLevels()
{
//_queries is a class handles all queries to my sql database.

ddlLevel.Datasource=_queries("select * from levels");
ddlLevel.DataTextField ="LevelName";
ddlLevel.DataValueField ="id";
ddlLevel.DataBind();
}

on my pageload event i call the _loadLevels() function. I have this condition

if(!IsPostback)
{
_loadLevels();
}
if(Session["_sectionid"]!=null)
{
string _result = Session["_sectionid"].Tostring();
}

//---------------
protected void ddlLevel_SelectedIndexChanged(object sender, EventArgs e)
{
Session["_sectionid"]=ddlSection.Selectedindex;
_getSection(); //-- this will populate the section in my ddlSection which values are
ex. DataTextField DataValueField
St.Dominic 1
St.Agustine 2
}

Autopostback of my DDL's is set to True and EnableViewState from my masterpage is also set into True.

Every time i select the second or third item in my ddlSection it always give me the first index I can't understand???...Im sure that there is no event calling my _getSection function only in the ddlLevel. by the way Im using Masterpage but there is no code i have in my masterpage. Please let me know what's happening on this scenario?

modified 30-Jul-14 1:38am.

GeneralRe: How to retain Dropdownlist value after selectedindexchanged and postback?? Pin
Member 924543130-Jul-14 0:38
Member 924543130-Jul-14 0:38 
GeneralRe: How to retain Dropdownlist value after selectedindexchanged and postback?? Pin
lan160730-Jul-14 19:35
lan160730-Jul-14 19:35 
Questiontag clipboard text Pin
Jassim Rahma27-Jul-14 11:59
Jassim Rahma27-Jul-14 11:59 
AnswerRe: tag clipboard text Pin
Garth J Lancaster27-Jul-14 13:20
professionalGarth J Lancaster27-Jul-14 13:20 
Questionhow do i get a table in gridview according to combobox fields? Pin
Sajeev Unni27-Jul-14 7:29
Sajeev Unni27-Jul-14 7:29 
AnswerRe: how do i get a table in gridview according to combobox fields? Pin
Pete O'Hanlon27-Jul-14 8:09
mvePete O'Hanlon27-Jul-14 8:09 
AnswerRe: how do i get a table in gridview according to combobox fields? Pin
Swinkaran28-Jul-14 19:09
professionalSwinkaran28-Jul-14 19:09 
QuestionMVC unit testing Pin
Marsh8727-Jul-14 3:09
Marsh8727-Jul-14 3:09 
AnswerRe: MVC unit testing Pin
Pete O'Hanlon27-Jul-14 3:41
mvePete O'Hanlon27-Jul-14 3:41 
AnswerRe: MVC unit testing Pin
Marsh8727-Jul-14 8:52
Marsh8727-Jul-14 8:52 
GeneralRe: MVC unit testing Pin
Pete O'Hanlon27-Jul-14 10:02
mvePete O'Hanlon27-Jul-14 10:02 
GeneralRe: MVC unit testing PinPopular
Dave Kreskowiak27-Jul-14 10:03
mveDave Kreskowiak27-Jul-14 10:03 
GeneralRe: MVC unit testing Pin
User 571134828-Jul-14 0:54
User 571134828-Jul-14 0:54 
QuestionMouse set in the form Pin
PozzaVecia27-Jul-14 1:47
PozzaVecia27-Jul-14 1:47 
AnswerRe: Mouse set in the form Pin
Pete O'Hanlon27-Jul-14 1:53
mvePete O'Hanlon27-Jul-14 1:53 
GeneralRe: Mouse set in the form Pin
PozzaVecia27-Jul-14 2:13
PozzaVecia27-Jul-14 2:13 
AnswerRe: Mouse set in the form Pin
OriginalGriff27-Jul-14 2:34
mveOriginalGriff27-Jul-14 2:34 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.