how to set the value of a dropdown to its default always

Posted by Praveen7k under ASP.NET on 6/14/2011 | Points: 10 | Views : 1424 | Status : [Member] | Replies : 3
A Page has Repeater Control displays students records, when click on any record it displays total info, this page has a dropdownlist and other controls contained in panel set to visible false. When the user search it displays the students info [ 10 rows ]
it displays SSN, FName, LName,DOB when he wants to see the more detail description of the student he clicks on that student row , then we make panel to be visible
it has a dropdown and set its dataTextfield to all the departments from the database. Here i want to display the dropdown to its default "Select deptartment" he selects any dept and clicks "SAVE" then page reloads and it again it should set to its default value "Select deptartment"....this one i am unable to do this

i did this way dd.items,insert(0,"Select deptartment").....> with this each time page reloads this item is added to dropdown
and i tried dd.selectedindex= 0
as the data items are coming from database..we cannot set the value to its default.. please urgent...




Responses

Posted by: Jayakumars on: 6/14/2011 [Member] [MVP] Bronze | Points: 25

Up
0
Down
hi

can you post code i will check and reply.

Mark as Answer if its helpful to you

Praveen7k, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Praveen7k on: 6/14/2011 [Member] Starter | Points: 25

Up
0
Down
hi
<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"
/>

Praveen7k, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Jayakumars on: 6/14/2011 [Member] [MVP] Bronze | Points: 25

Up
0
Down
hi

this is drop down side only i know bind dropdown send your full code i will dl and check and reply them.
or explain clearly what is ur requirements.

Mark as Answer if its helpful to you

Praveen7k, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response