Поиск:

Ответ в темуСоздание новой темы Создание опроса
> Gridview.sorting 
:(
    Опции темы
Rdk
Дата 12.2.2008, 18:16 (ссылка) | (нет голосов) Загрузка ... Загрузка ... Быстрая цитата Цитата


Новичок



Профиль
Группа: Участник
Сообщений: 5
Регистрация: 12.2.2008

Репутация: нет
Всего: нет



народ, помогите!!!! Вобщем такая ситуация:
1) динмаческий создаю Gridview (их количество заранее не известно и может варироваться)
2) создаю столбцы и вбиваю их в грид
3) столбцы можно сортировать
4) грид нормально выводится на экран со всеми данными

У меня все и вся создается только динамически, из статического только PlaceHolder

проблема:
страничка обновляется, но строки не сортируются...  подскажите что и как? я сам пока новичок в этом деле..Плиииииз!!!
 
Вот код:
public partial class APRFAssessment : System.Web.UI.Page
{
    DataSet dataSet;
    GridView[] g_View;
    GridView gv = new GridView();
    DataTable dataTable = new DataTable();



    protected void APRFAssessment_Sorting(object sender, GridViewSortEventArgs e)
    {
   
        e.SortDirection = SortDirection.Descending;
    
      }

       
    protected void Page_Load (object sender, EventArgs e)
    {
        
          //-setting connecton to
            .....
            
        //---Creating Data Adapter and specifying SQL command and connection
            //---Filling Data Set with daba base table "Team" from  Data Adapter 
            SqlDataAdapter adapter = new SqlDataAdapter("SELECT * FROM Team", connection);
            dataSet = new DataSet();
            adapter.Fill(dataSet, "Team");
           
            //---Creating new data table and filling it with table from DataSet

            dataTable = dataSet.Tables[0];
           
                int i = 0,
                count = 0;
            count = dataTable.Rows.Count;
            Guid[] UserId = new Guid[count];
            DataRow dataRow = null;
           .........

            BoundField[] bf = new BoundField[10];

            g_View = new GridView[count];



            dataRow = dataTable.Rows[0];


            AjaxControlToolkit.TabContainer tabcon = new AjaxControlToolkit.TabContainer();
            AjaxControlToolkit.TabPanel[] tabpan = new AjaxControlToolkit.TabPanel[count];
            tabcon.BorderColor = Color.Chocolate;
            tabcon.BorderWidth = 3;


            // foreach (DataRow Row in dataTable.Rows)
            // {
            DataRow Row = dataTable.Rows[0];

            SqlCommand command = new SqlCommand("dbo.GetAprfAssessmentTeamData");
            command.CommandType = CommandType.StoredProcedure;
            command.Connection = connection;
            command.Parameters.Add(new SqlParameter("@TeamID", Row[0]));
            command.Parameters.Add(new SqlParameter("@UserID", "edf26fd8-d7cd-4b32-a18a-fc888cac63ef"));
           
           SqlDataReader rdr = command.ExecuteReader();
            
           g_View[i] = new GridView();
            g_View[i].DataSource = rdr;
            g_View[i].AutoGenerateColumns = false;
            g_View[i].AllowSorting = true;
            g_View[i].ShowFooter = true;
          
            //----------------------------------------------------------------------------------------------           


            //----------------------------------------------------------------------------------------------           
            #region(HyperLinkField)
            HyperLinkField hlf = new HyperLinkField();
            hlf.DataTextField = "PRefNumFull";
            hlf.FooterText = "ReferenceNum";
            hlf.HeaderText = "ReferenceNum";
            hlf.FooterStyle.BorderColor = Color.HotPink;
            hlf.FooterStyle.BorderWidth = 3;
            hlf.DataNavigateUrlFields = "PID".Split();
            hlf.DataNavigateUrlFormatString = "APRFAssessment_popup.aspx?PID={0}";
            hlf.Target = "_blank";
            hlf.SortExpression = "PRefNumFull";
            g_View[0].Sorting += new GridViewSortEventHandler(APRFAssessment_Sorting);
            g_View[i].Columns.Add(hlf);

            #endregion

            #region(filed[PackageName])
            bf[0] = new BoundField();
            bf[0].DataField = "PName";
            bf[0].HeaderText = "PackageName";
            bf[0].FooterText = "packageName";
            bf[0].FooterStyle.BorderWidth = 2;
            bf[0].FooterStyle.BorderColor = Color.Khaki;
            bf[0].SortExpression = "PName";
            g_View[i].Columns.Add(bf[0]);

            #endregion

                  g_View[i].DataBind();

            rdr.Close();
            command.Parameters.Clear();
            connection.Close();


            APRFPlaceHolder.Controls.Add(g_View[i]);

            //i++;
            //  }
            
    }
}

PM MAIL   Вверх
  
Ответ в темуСоздание новой темы Создание опроса
0 Пользователей читают эту тему (0 Гостей и 0 Скрытых Пользователей)
0 Пользователей:
« Предыдущая тема | ASP | Следующая тема »


 




[ Время генерации скрипта: 0.0430 ]   [ Использовано запросов: 21 ]   [ GZIP включён ]


Реклама на сайте     Информационное спонсорство

 
По вопросам размещения рекламы пишите на vladimir(sobaka)vingrad.ru
Отказ от ответственности     Powered by Invision Power Board(R) 1.3 © 2003  IPS, Inc.