Click here to Skip to main content
15,392,968 members
Home / Discussions / ASP.NET
   

ASP.NET

 
GeneralRe: Why can't I login to the web even though the User and password are correct ? Pin
Member 245846714-Jan-20 16:19
MemberMember 245846714-Jan-20 16:19 
GeneralRe: Why can't I login to the web even though the User and password are correct ? Pin
ZurdoDev14-Jan-20 16:52
professionalZurdoDev14-Jan-20 16:52 
AnswerRe: Why can't I login to the web even though the User and password are correct ? Pin
Richard Deeming10-Jan-20 2:32
mveRichard Deeming10-Jan-20 2:32 
GeneralRe: Why can't I login to the web even though the User and password are correct ? Pin
Member 245846714-Jan-20 16:24
MemberMember 245846714-Jan-20 16:24 
GeneralRe: Why can't I login to the web even though the User and password are correct ? Pin
Richard Deeming15-Jan-20 0:25
mveRichard Deeming15-Jan-20 0:25 
GeneralRe: Why can't I login to the web even though the User and password are correct ? Pin
Member 245846716-Jan-20 20:23
MemberMember 245846716-Jan-20 20:23 
GeneralRe: Why can't I login to the web even though the User and password are correct ? Pin
Richard Deeming17-Jan-20 0:30
mveRichard Deeming17-Jan-20 0:30 
QuestionHow do you have a DropDownList populated without default selected item? Pin
Member 114033049-Jan-20 6:07
MemberMember 114033049-Jan-20 6:07 
I have a RequestorDropDownList which is populated with a list of names from a GetRequestorInfoModel.
I need help to make a change so that when this list is populated, the first name is not automatically selected until a user selects it.
How do I do this based on my code below?


ASP code for the dropdownlist
C#
<asp:DropDownList ID="RequestorDropDownList" runat="server" Font-Size="8.25pt" 
     Height="20px" ToolTip="Requestor" Width="160px" SelectMethod="GetRequestorEmail"
     DataTextField="DisplayName" DataValueField="Email" 
     OnSelectedIndexChanged="RequestorDropDownList_SelectedIndexChanged">
</asp:DropDownList>


Code behind that is populating the dropdownlist
C#
#region Requestor dropdownlist
public async Task<IEnumerable<GetRequestorInfoModel>> GetRequestorEmail()
{                             
   try
   {
      var requestors = await FTACaseReseting.Controllers.RequestorInfoController.GetAllRequestorInfoes();
      //Show first name as selected
      return requestors.OrderBy(x => x.DisplayName);
   }
   catch (Exception ex)
   {
      string errorMsg = string.Format("An error has occured in {0}. \nException:\n{1}", "PopulateRequestorComboBox()", ex.Message);
      Response.Write("<script>alert(" + HttpUtility.JavaScriptStringEncode(errorMsg, true) + ")</script>");
      return Enumerable.Empty<GetRequestorInfoModel>();
   }
}
#endregion


Here is code for RequestorDropDownList_SelectedIndexChanged
C#
protected void RequestorDropDownList_SelectedIndexChanged(object sender, EventArgs e)
 {
    if (RequestorDropDownList.SelectedItem ==null)
     {
        ListItem requestorItem = new ListItem();
        requestorItem = (ListItem)RequestorDropDownList.SelectedItem;

        if (requestorItem.Text.Length < 0)
        {
           string selectRequestor = "Please select a Requestor.";
           ClientScript.RegisterStartupScript(this.GetType(), "myalert", "alert('" + selectRequestor + "');", true);
         }
         this.EmailButton.Enabled = false;
         RequestorDropDownList.SelectedValue = RequestorDropDownList.SelectedItem.Value;
     }

}


modified 9-Jan-20 12:29pm.

AnswerRe: How do you have a DropDownList populated without default selected item? Pin
ZurdoDev9-Jan-20 6:40
professionalZurdoDev9-Jan-20 6:40 
GeneralRe: How do you have a DropDownList populated without default selected item? Pin
Member 114033049-Jan-20 6:56
MemberMember 114033049-Jan-20 6:56 
GeneralRe: How do you have a DropDownList populated without default selected item? Pin
ZurdoDev9-Jan-20 7:59
professionalZurdoDev9-Jan-20 7:59 
GeneralRe: How do you have a DropDownList populated without default selected item? Pin
Mycroft Holmes9-Jan-20 10:14
professionalMycroft Holmes9-Jan-20 10:14 
QuestionHow to I make EmailButton_Click work? Pin
Member 114033048-Jan-20 4:59
MemberMember 114033048-Jan-20 4:59 
AnswerRe: How to I make EmailButton_Click work? Pin
ZurdoDev8-Jan-20 5:21
professionalZurdoDev8-Jan-20 5:21 
AnswerRe: How to I make EmailButton_Click work? Pin
F-ES Sitecore8-Jan-20 5:45
professionalF-ES Sitecore8-Jan-20 5:45 
GeneralRe: How to I make EmailButton_Click work? Pin
Member 114033048-Jan-20 11:16
MemberMember 114033048-Jan-20 11:16 
GeneralRe: How to I make EmailButton_Click work? Pin
F-ES Sitecore8-Jan-20 22:11
professionalF-ES Sitecore8-Jan-20 22:11 
QuestionHow do I make my GetCasesButton_Click work? Pin
Member 114033048-Jan-20 4:46
MemberMember 114033048-Jan-20 4:46 
AnswerRe: How do I make my GetCasesButton_Click work? Pin
ZurdoDev8-Jan-20 5:19
professionalZurdoDev8-Jan-20 5:19 
GeneralRe: How do I make my GetCasesButton_Click work? Pin
Member 114033048-Jan-20 7:56
MemberMember 114033048-Jan-20 7:56 
QuestionHow do I make my GetCasesButton_Click work? Pin
Member 114033048-Jan-20 4:33
MemberMember 114033048-Jan-20 4:33 
AnswerRe: How do I make my GetCasesButton_Click work? Pin
ZurdoDev8-Jan-20 5:18
professionalZurdoDev8-Jan-20 5:18 
QuestionText with Audio Pin
Member 104440587-Jan-20 21:19
MemberMember 104440587-Jan-20 21:19 
AnswerRe: Text with Audio Pin
ZurdoDev8-Jan-20 0:57
professionalZurdoDev8-Jan-20 0:57 
GeneralRe: Text with Audio Pin
Member 104440588-Jan-20 19:47
MemberMember 104440588-Jan-20 19:47 

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.