Click here to Skip to main content
15,886,873 members
Home / Discussions / ASP.NET
   

ASP.NET

 
PinnedHOW TO ANSWER A QUESTION PinPopular
Chris Maunder12-Jul-09 22:39
cofounderChris Maunder12-Jul-09 22:39 
Questionassertion failed : unrecognized tag script Pin
Patil Anant9-Mar-24 2:07
Patil Anant9-Mar-24 2:07 
AnswerRe: assertion failed : unrecognized tag script Pin
Richard MacCutchan9-Mar-24 2:30
mveRichard MacCutchan9-Mar-24 2:30 
AnswerRe: assertion failed : unrecognized tag script Pin
Andre Oosthuizen12-Mar-24 6:57
mveAndre Oosthuizen12-Mar-24 6:57 
Questionis it hard to add new module into Umbraco CMS? Pin
Southmountain7-Feb-24 8:23
Southmountain7-Feb-24 8:23 
AnswerRe: is it hard to add new module into Umbraco CMS? Pin
RedDk7-Feb-24 8:43
RedDk7-Feb-24 8:43 
QuestionUI library for ASP.NET Core MVC Razor Pin
Mark Pelf 8-Dec-23 5:18
mvaMark Pelf 8-Dec-23 5:18 
QuestionCoding Help Pin
appache0524-Nov-23 18:04
appache0524-Nov-23 18:04 
AnswerRe: Coding Help Pin
Richard MacCutchan24-Nov-23 22:05
mveRichard MacCutchan24-Nov-23 22:05 
AnswerRe: Coding Help Pin
Andre Oosthuizen25-Nov-23 1:24
mveAndre Oosthuizen25-Nov-23 1:24 
AnswerRe: Coding Help Pin
jschell25-Nov-23 7:02
jschell25-Nov-23 7:02 
QuestionWhat should I start reading to get to where I want to go? Pin
DalTXColtsFan21-Nov-23 11:46
DalTXColtsFan21-Nov-23 11:46 
AnswerRe: What should I start reading to get to where I want to go? Pin
Richard MacCutchan21-Nov-23 21:37
mveRichard MacCutchan21-Nov-23 21:37 
QuestionSelectedIndexChanged for DropDown not fired when first item selected Pin
DalTXColtsFan17-Nov-23 7:41
DalTXColtsFan17-Nov-23 7:41 
I wish it was a little easier to post screenshots here, but what's going on is my SelectedIndexChanged event handler is being triggered if I choose any item in the dropdown OTHER THAN THE TOP ONE. When I choose the top item in the dropdown, Page_Load is getting fired, but not SelectedIndexChanged. What's going on?

<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="First2023WebUserControl.ascx.cs" Inherits="First2023Control.UserControls.First2023WebUserControl" %>
<asp:Label ID="Label1" runat="server" Text="Hello Year 2023"></asp:Label>
<p>
     </p>
Category:<asp:DropDownList ID="ddlCategory" runat="server" AutoPostBack="True" OnSelectedIndexChanged="ddlCategory_SelectedIndexChanged">
</asp:DropDownList>
<p>
    Subcategory:
    <asp:DropDownList ID="ddlSubcategory" runat="server" AutoPostBack="True">
    </asp:DropDownList>
</p>
<p>
    <asp:Label ID="Label2" runat="server" Text="Label"></asp:Label>
</p>
<asp:Button ID="Button1" runat="server" OnClick="Button1_Click" Text="Button" />
<asp:Label ID="Label3" runat="server" Text="Label"></asp:Label>


protected void Page_Load(object sender, EventArgs e)
{

        Label3.Text = "In Page Load selected index is " + ddlCategory.SelectedIndex.ToString();
        XXXDbSupport objDBSupport = new XXXDbSupport();
        DbCommand objDBCommand = objDBSupport.CreateDbCommand();
        objDBCommand.CommandType = CommandType.Text;
        string sSQL = "select distinct isnull(Category,'(blank)') as ProdCat from xxx_product order by isnull(Category,'(blank)')";
        objDBCommand.CommandText = sSQL;
        DataTable objDBTable = objDBSupport.FillDataTable(objDBCommand);
        if (objDBTable.Rows.Count > 0)
        {
            ddlCategory.DataTextField = "ProdCat";
            ddlCategory.DataValueField = "ProdCat";
            ddlCategory.DataSource = objDBTable;
            ddlCategory.DataBind();
        }
        else
        {
            ddlCategory.Text = "n/a";
        }

}

protected void ddlCategory_SelectedIndexChanged(object sender, EventArgs e)
{
    Label2.Text = "The selected index changed to " + ddlCategory.SelectedIndex.ToString();
    XXXDbSupport objDBSupport = new XXXDbSupport();
    DbCommand objDBCommand = objDBSupport.CreateDbCommand();
    objDBCommand.CommandType = CommandType.Text;
    string sSQL = "select distinct isnull(SubCategory,'(blank)') as SubCat from xxx_product ";
    if (ddlCategory.Text == "(blank)")
    {
        sSQL = sSQL + "where isnull(Category,'(blank)') = '(blank)' order by isnull(SubCategory,'(blank)')";
    }
    else
    {
        sSQL = sSQL + "where Category = '" + ddlCategory.Text + "' order by isnull(SubCategory,'(blank)')";
    }
    objDBCommand.CommandText = sSQL;
    DataTable objDBTable = objDBSupport.FillDataTable(objDBCommand);
    if (objDBTable.Rows.Count > 0)
    {
        ddlSubcategory.DataTextField = "SubCat";
        ddlSubcategory.DataValueField = "SubCat";
        ddlSubcategory.DataSource = objDBTable;
        ddlSubcategory.DataBind();
    }
    else
    {
        ddlSubcategory.Text = "n/a";
    }

}

AnswerRe: SelectedIndexChanged for DropDown not fired when first item selected Pin
Ron Nicholson17-Nov-23 7:57
professionalRon Nicholson17-Nov-23 7:57 
GeneralRe: SelectedIndexChanged for DropDown not fired when first item selected Pin
DalTXColtsFan17-Nov-23 8:03
DalTXColtsFan17-Nov-23 8:03 
GeneralRe: SelectedIndexChanged for DropDown not fired when first item selected Pin
Andre Oosthuizen18-Nov-23 7:27
mveAndre Oosthuizen18-Nov-23 7:27 
SuggestionRe: SelectedIndexChanged for DropDown not fired when first item selected Pin
Richard Deeming19-Nov-23 21:56
mveRichard Deeming19-Nov-23 21:56 
QuestionDumb it down for one who's basically a beginner Pin
DalTXColtsFan15-Nov-23 5:31
DalTXColtsFan15-Nov-23 5:31 
AnswerRe: Dumb it down for one who's basically a beginner Pin
Andre Oosthuizen15-Nov-23 7:25
mveAndre Oosthuizen15-Nov-23 7:25 
GeneralRe: Dumb it down for one who's basically a beginner Pin
DalTXColtsFan15-Nov-23 11:48
DalTXColtsFan15-Nov-23 11:48 
GeneralRe: Dumb it down for one who's basically a beginner Pin
Andre Oosthuizen16-Nov-23 5:36
mveAndre Oosthuizen16-Nov-23 5:36 
Questioncan't build blazor library in azure pipeline Pin
Super Lloyd6-Sep-23 17:08
Super Lloyd6-Sep-23 17:08 
AnswerRe: can't build blazor library in azure pipeline Pin
Super Lloyd6-Sep-23 18:27
Super Lloyd6-Sep-23 18:27 
QuestionBlazor component debugging Pin
Super Lloyd23-Aug-23 14:16
Super Lloyd23-Aug-23 14:16 

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.