Click here to Skip to main content
16,010,553 members
Home / Discussions / ASP.NET
   

ASP.NET

 
QuestionHow to Identify that Connected database is MySql, Sql Express, Sql Server 2000, etc. Pin
pandeybrijendra2-Jun-08 23:04
pandeybrijendra2-Jun-08 23:04 
QuestionMultiple Gridview mantaining LINQ relationships Pin
Ponzano Paolo2-Jun-08 21:43
Ponzano Paolo2-Jun-08 21:43 
Questionhow to associate event handler for dynamically created dropdownlist Pin
vidhyap2-Jun-08 21:35
vidhyap2-Jun-08 21:35 
AnswerRe: how to associate event handler for dynamically created dropdownlist Pin
eyeseetee2-Jun-08 21:58
eyeseetee2-Jun-08 21:58 
AnswerRe: how to associate event handler for dynamically created dropdownlist Pin
N a v a n e e t h2-Jun-08 22:15
N a v a n e e t h2-Jun-08 22:15 
GeneralRe: how to associate event handler for dynamically created dropdownlist Pin
vidhyap2-Jun-08 23:34
vidhyap2-Jun-08 23:34 
GeneralRe: how to associate event handler for dynamically created dropdownlist Pin
N a v a n e e t h3-Jun-08 0:01
N a v a n e e t h3-Jun-08 0:01 
GeneralRe: how to associate event handler for dynamically created dropdownlist Pin
vidhyap3-Jun-08 0:14
vidhyap3-Jun-08 0:14 
what exactly I am doing is,based on selected value of first dropdownlist value,I am creating different number of dropdownlist box dynamically.

below code is for selected indexchanged for first dropdown:
protected void ddlSurveyName_SelectedIndexChanged(object sender, EventArgs e)
    {


        if (ddlSurveyName.SelectedItem.Text != "Select")
        {
            int surveyIdentity = Convert.ToInt32(ddlSurveyName.SelectedValue);
            lblErrorSurveyName.Visible = false;
            ISession session = NHibernateSessionManager.Instance.GetSession();

            IQuery surveyAttributeQry = session.CreateQuery("from SurveyAttributeEntity se where SurveyID='" + surveyIdentity + "'");
            IList surveyAttributeList = surveyAttributeQry.List();
            foreach (SurveyAttributeEntity surveysAttributeEn in surveyAttributeList)
            {
                int surveyId = Convert.ToInt32(surveysAttributeEn.SurveyID);
                int attributeId = Convert.ToInt32(surveysAttributeEn.AttributeID);
                createddl(surveyId, attributeId);
            }
        }
        else
        {

            lblErrorSurveyName.Visible = true;
            lblErrorSurveyName.Text = Resources.VP_THAI.lblErrorSurveyName;
        }
        
            ddlExportTo.Enabled = false;
      
    }


and later i have to check for hierarchy dropdownlist box,if it is created dynamically,based on the value of this Hierarchy dropdownlist i have to create one more dropdownlist and depending on the selected value of newly created dropdownlist i am going to create one more.

code i am using to create dynamic dropdownlist is as below:
protected void createddl(int surveyID, int attributeID)
    {
        ISession session = NHibernateSessionManager.Instance.GetSession();
        IQuery attributeValueQry = session.CreateQuery("from MasterValueEntity mve where TypeID='" + attributeID + "'");
        IList attributeValueList = attributeValueQry.List();
        IQuery labelValueQry = session.CreateQuery("from MASTERTYPEEntity mte where TypeID='" + attributeID + "'");
        IList labelValueList = labelValueQry.List();
        IQuery hierarchyValueQry = session.CreateQuery("from HierarchyEntity hierarchentity where Level="+1);
        IList hierarchyValueList = hierarchyValueQry.List();
        DropDownList list = new DropDownList();
        CheckBox chkAndAbove = new CheckBox();
        list.Items.Add("Select");
        Label label1 = new Label();
        
        if (attributeID == 0)
        {
            label1.Text = "Hierarchy";
            label1.Width = Unit.Percentage(60);
            label1.Height = Unit.Percentage(50);
            list.ID = "Hierarchy";
            list.AppendDataBoundItems = true;
            list.Width = Unit.Percentage(65);
            list.Items[0].Text = "Select";
            list.Items[0].Value = "-1";
            list.Items[0].Selected = true;
            list.DataValueField = "Id";
            list.DataTextField = "Hname";
            list.DataSource = hierarchyValueList;
            list.DataBind();
            list.AutoPostBack = true;
            list.SelectedIndexChanged += new EventHandler(list_SelectedIndexChanged);
            chkAndAbove.Text = "And Above";
        }
        else
        {
            foreach (MASTERTYPEEntity masterTypeEn in labelValueList)
            {
               list.ID = masterTypeEn.TypeName;
                label1.Text = masterTypeEn.TypeName;
                label1.Width = Unit.Percentage(60);
                label1.Height = Unit.Percentage(50);
            }
            list.AppendDataBoundItems = true;
            list.Width = Unit.Percentage(65);
            list.Items[0].Text = "Select";
            list.Items[0].Value = "-1";
            list.Items[0].Selected = true;
            list.DataValueField = "Id";
            list.DataTextField = "TypeDesc";
            list.DataSource = attributeValueList;
            list.DataBind();
            
           
        }
        PlaceHolder1.Controls.Add(label1);
        
        PlaceHolder2.Controls.Add(list);
        //PlaceHolder2.Controls.Add(chkAndAbove);
        PlaceHolder2.EnableViewState = true;
        session.Close();
        NHibernateSessionManager.Instance.CloseSession();
    }

now can you give me any suggestion to proceed on the same.


Regards
Vidhya

GeneralRe: how to associate event handler for dynamically created dropdownlist Pin
N a v a n e e t h3-Jun-08 1:02
N a v a n e e t h3-Jun-08 1:02 
GeneralRe: how to associate event handler for dynamically created dropdownlist Pin
vidhyap3-Jun-08 18:18
vidhyap3-Jun-08 18:18 
GeneralRe: how to associate event handler for dynamically created dropdownlist Pin
N a v a n e e t h4-Jun-08 3:48
N a v a n e e t h4-Jun-08 3:48 
AnswerRe: how to associate event handler for dynamically created dropdownlist Pin
Baran M3-Jun-08 3:24
Baran M3-Jun-08 3:24 
GeneralRe: how to associate event handler for dynamically created dropdownlist Pin
vidhyap3-Jun-08 17:03
vidhyap3-Jun-08 17:03 
Questionajaxtoolkit problem Pin
Miss Maheshwari2-Jun-08 21:23
Miss Maheshwari2-Jun-08 21:23 
AnswerRe: ajaxtoolkit problem Pin
eyeseetee2-Jun-08 21:57
eyeseetee2-Jun-08 21:57 
GeneralRe: ajaxtoolkit problem Pin
Miss Maheshwari2-Jun-08 22:05
Miss Maheshwari2-Jun-08 22:05 
GeneralRe: ajaxtoolkit problem Pin
N a v a n e e t h2-Jun-08 22:17
N a v a n e e t h2-Jun-08 22:17 
GeneralRe: ajaxtoolkit problem Pin
eyeseetee2-Jun-08 22:37
eyeseetee2-Jun-08 22:37 
GeneralRe: ajaxtoolkit problem Pin
Miss Maheshwari2-Jun-08 23:01
Miss Maheshwari2-Jun-08 23:01 
GeneralRe: ajaxtoolkit problem Pin
eyeseetee2-Jun-08 23:04
eyeseetee2-Jun-08 23:04 
GeneralRe: ajaxtoolkit problem Pin
Miss Maheshwari2-Jun-08 23:16
Miss Maheshwari2-Jun-08 23:16 
GeneralRe: ajaxtoolkit problem Pin
eyeseetee2-Jun-08 23:26
eyeseetee2-Jun-08 23:26 
GeneralRe: ajaxtoolkit problem Pin
Gayani Devapriya3-Jun-08 2:53
Gayani Devapriya3-Jun-08 2:53 
GeneralRe: ajaxtoolkit problem Pin
eyeseetee3-Jun-08 3:36
eyeseetee3-Jun-08 3:36 
QuestionGet Cache from Website Pin
Kumaran21cen2-Jun-08 20:58
Kumaran21cen2-Jun-08 20:58 

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.