I have a home page, where I get the div to & lt; Asp: repeater ... / & gt;
Control Now & lt; Div & gt; On click event on a button in
, I am sending this page to the registration form where I have the & lt; ASP: Dropdown ... />
control.
On the event of the Page_load
registration page, I am populating the dropdown from the database and DataTextField
and DataValueField
.
Now I type EventTypeID
to the dropdown. Specifying the drop code from DataValueField
and names
. .DataTextField . I have also checked that in the dropdown on the rendering, the code is EventTypeID
in the value
field
:
Protected Zero Page_Old (Object Sender, EventArgues E) {Event Typogologic Event Typical Labic = New Event Type Opposite (;); Int eventTypeID = Convert.ToInt32 (Request .Jquery String ["id"]); DdlEventType.DataSource = eventTypeLogic.populateEventTypeDDL (); DdlEventType.DataValueField = "EventTypeID"; DdlEventType.DataTextField = "name"; DdlEventType.DataBind (); DdlEventType.Items.Instert (0, new list item ("Choose Event Type", "0")); If (eventTypeID> 0) {ddlEventType.SelectedIndex = eventTypeID; }}
dropdown ASPX code:
& asp: dropdown list id = "ddlEventType" runat = "server" CssClass = "span2 form-info" />
Home page code:
& lt; / P & gt; & Lt; H6 & gt; & Lt; A class = "BTN BTN-custom" href = '& lt; % # "HostEvent.aspx? Id =" + Eval ("EventTypeID")%> '& Gt; & Lt; B & gt; Host Event & lt; / B & gt; & Lt; / A & gt; & Lt; / H6 & gt;
Problem: I want the drop-down to be hand selected before hand, depending on the selection on the home page.
Update:
Protected Zero Page_Old (Object Sender, EventArggs E) {Event Type Lologic Event Taclausic = New Event Type (Latin) ; Int eventTypeID = Convert.ToInt32 (Request .Jquery String ["id"]); String name = Event typoogic. Rolvetmon (EventTapID); DdlEventType.DataSource = eventTypeLogic.populateEventTypeDDL (); DdlEventType.DataValueField = "EventTypeID"; DdlEventType.DataTextField = "name"; DdlEventType.Items.Instert (0, new list item ("Choose Event Type", "0")); //ddlEventType.DataBind (); DdlEventType.SelectedIndex = eventTypeID; DdlEventType.DataBind (); }
If you want to display EventName
Before requesting a query with eventTypeId
, get a pre-selected value in your Ddl
and all the information about that event and try it out.
/ / I think that when you check the fire you get an item `event details` if (eventTypeID> 0) {ddlEventType.SelectedIndex = eventTypeID; DdlEventType.SelectedValue = EventDetails.EventTypeID.ToString (); }
This should work!
No comments:
Post a Comment