How to work with Dynamic populate extender

Last post 05-16-2008 11:30 AM by Diddigam. 1 replies.

Sort Posts:

  • How to work with Dynamic populate extender

    05-14-2008, 2:15 AM

    Hello

    Can any one tell me how to use Dynamic Populate Extender.

    Is possible try to send me one sample code for populating a dropdownbox on clicking a button.

    Waiting for reply. 

     

  • Re: How to work with Dynamic populate extender

    05-16-2008, 11:30 AM
    Answer
    • Loading...
    • Diddigam
    • Joined on 05-14-2008, 10:16 AM
    • Posts 9

    Hi Kishore.......

    If u want to populate Drop Down Dynamically

    First U need to write the Stored Procedure In Data Base and

    second thing U need to write the Populate method in Presentation Layer and

    3rd is u need to write code in DataAccess Layer to data from DataBase 

     code for Presentation Layer is

    private void PopulateDropDown()
        {
                //daStdent is DataAccessLayer Name and next daStdent is DataAccess class name

               daStudent.daStudent objUser = new daStudent.daStudent();

      //GetStudentListInfo is stored procedure


            DataTable dtStudentList = objUser.GetStudentListInfo(connectionString);

            int nTotalRecords = dtStudentList.Rows.Count;
           
            for (int i = 0; i < nTotalRecords; i++)
            {

       //GVDDL is drop down box name
               GVDDL.Items.Add(dtStudentList.Rows[i]["LastName"].ToString());
            }

       }

     

    code for DataAccessLayer

     


            public DataTable GetStudentListInfo(string ConnectionString)
            {
                //int LastName
                // Set up parameters in parameter array
                SqlParameter[] arParms = new SqlParameter[1];


                //arParms[0] = new SqlParameter("@LastName", SqlDbType.NVarChar);
                // arParms[0].Value = LastName;

                pTransactionSuccessful = true;

                DataTable dtStudentList = new DataTable("StudentList");

                try
                {
                    DataSet dsStudentList = SqlHelper.ExecuteDataset(ConnectionString, CommandType.StoredProcedure, "GetStudentListInfo", arParms);
                    dtStudentList = dsStudentList.Tables[0];
                }
                catch (SqlException ReadError)
                {
                    pErrorMessage = ReadError.Message.ToString();
                    pErrorNumber = ReadError.Number;
                    pErrorClass = ReadError.Class;
                    pErrorState = ReadError.State;
                    pErrorLineNumber = ReadError.LineNumber;

                    pTransactionSuccessful = false;
                }
                return dtStudentList;
            }
     


     If u still unable to do give me a reply with the error.........

     

Page 1 of 1 (2 items)
Microsoft Communities
Page view counter