locked
Add dropdown only Admin when add user otherwise not visible in ASP.NET ENTITY FRAMEWORK RRS feed

  • Question

  • User186310208 posted

    hello...!

    I want to add dropdown when Admin add user otherwise the DropDown functionality is not visible in Asp.net Entity Framework...

    can someone help me out..!

     

    Thursday, August 6, 2020 10:05 AM

Answers

  • User1535942433 posted

    Hi guestadmin@nirvriti.com,

    Accroding to your description,do you tell us more details of your requirments?How do you trigger the event to add dropdown and where do you add the dropdown?

    I'm guessing that you need to check if the indentity is Admin,and then when admin click the button to add users,the form will show the dropdown.

    Since you don't post your codes,I create a demo,just like this:

    <asp:Button ID="Button2" runat="server" Text="Add"  OnClick="Button2_Click"/>
    <asp:Panel ID="Panel1" runat="server"></asp:Panel>

    Code-Behind:

    protected void Button2_Click(object sender, EventArgs e)
            {
    
                if (Session["user"].ToString() == "Admin")
                {
                    DropDownList ddl = new DropDownList();
                    ddl.ID = "ddl1";
                    ddl.Text = "ddl";
                    ddl.Items.Add("Hii");
                    ddl.Items.Add("Hello");
                    ddl.AutoPostBack = true;
                    Panel1.Controls.Add(ddl);
                }
            }

    Could you post more details of requirments and full codes to us?It will help us to solve your problem.

    Best regards,

    Yijing Sun

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Friday, August 7, 2020 2:00 AM