Reputation:
Page has Repeater Control displays students records, when click on any record it displays total info. it has dropdown list displays list of all departments [ not static items ] comes from
db.<asp:DropDownList ID="ddl_name" runat="server" DataSourceID="Employee" DataMember="Technical"
DataTextField="Last_name"
DataValueField="Emp_code"
FirstItemText="Select Item"
FirstItemValue="0"
BoundColumnName="LastName"
BoundDataMember="DeptCode"
Clear="true"
/> Thanks...
by default it should display the first item..and when the user selects a department and save it, the page reloads and again it should show the default value.
Upvotes: 0
Views: 5681
Reputation: 1117
You may also try storing selected value in a variable or Session[""]
Upvotes: 0
Reputation: 1301
You can do it via DropDownList.SelectedIndex property:
ddl.SelectedIndex = 0;
But I would recommend using Post-Redirect-Get instead and after a redirect-get you will have your dropdown set to default.
Upvotes: 1