Monday, March 26, 2012

Problem about area of focus

Hello frnds,

I have created Web application using AJAX control tool kit......you may view it here......

www.calstate.edu/majors


My problem here is that If I select 1 item from DropDownList(DDL) 1 and then choose DDL2 and then press search button; everything works fine.....

But now If I select other item from DDL1 again, so I want the DDL2 to be set to default value as Before ie. I want it to be to Select Major Type/Degree....so what shud be added in order to change the default value of DDL2 back to original.


Thanks ur help is highly appreciated

Hemil.

write a event for DDL1's selectedindexchanged and set the ddl2's selectedindex to 0.

And also mark enableautopostback to true for ddl1


hi,

After seen the site I think the problem is that the selected value of second DDL is remain as it is so after the search result of in the selected index chnage event of first DDL just make the SelectedValue to default means index to 0 every time then it will be work


I tried changing the same, but When I write the line in the function

protected void majorDDL_SelectedIndexChanged(object sender, EventArgs e)

it says cannot assign to majorDDL_SelectedIndexChanged becoz it is a method grp.......so where shud I write the value 0....


Could you please share your code?


C-sharp file

protected void majorDDL_SelectedIndexChanged(object sender, EventArgs e)
{
visibleOff();
searchButton.Enabled = false;

}

.aspx file

<ajaxToolkit:ToolkitScriptManager ID="ScriptManager1" runat="server" /
<label for="majorDDL" style="display:none;">Select Programs Name and Type:</label><asp:DropDownList ID="majorDDL" runat="server"
OnSelectedIndexChanged="majorDDL_SelectedIndexChanged"
AutoPostBack="True">
</asp:DropDownList
<ajaxToolkit:CascadingDropDown ID="CascadingDropDown1" runat="server"
ServiceMethod="GetDropDownContents"
UseContextKey="True"
Category="major"
LoadingText="..."
PromptText="Degree Major/ Program Name"
ServicePath="MajorsDatabase.asmx"
TargetControlID="majorDDL">
</ajaxToolkit:CascadingDropDown>
<br /><br />
<label for="typeDDL" style="display:none;">Select Programs Name and Type:</label>
<asp:DropDownList ID="typeDDL" runat="server"
OnSelectedIndexChanged="typeDDL_SelectedIndexChanged" AutoPostBack="True">
</asp:DropDownList>

<ajaxToolkit:CascadingDropDown ID="CascadingDropDown2" runat="server"
ParentControlID="majorDDL"
Category="type"
ContextKey="..."
PromptText="Degree Major/ Program Type"
ServiceMethod="GetDropDownContents"
ServicePath="MajorsDatabase.asmx"
TargetControlID="typeDDL">
</ajaxToolkit:CascadingDropDown


I want to make DROPDOWN 2 value to default ie it shud display the value of PromptText="Degree Major/ Program Type".......


I suppose this is automatically handle by extender

http://asp.net/ajax/ajaxcontroltoolkit/samples/

No comments:

Post a Comment