Wrox Programmer Forums
|
ASP.NET 1.0 and 1.1 Basics ASP.NET discussion for users new to coding in ASP.NET 1.0 or 1.1. NOT for the older "classic" ASP 3 or the newer ASP.NET 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 1.0 and 1.1 Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old October 27th, 2005, 02:46 PM
Authorized User
 
Join Date: Oct 2005
Posts: 27
Thanks: 0
Thanked 0 Times in 0 Posts
Default Large Text Sorting Problem

I have a DG that has a very large text field. I want the user to be able to sort by this field. If I hardcode a this

ORDER BY CAST(Q_Text As varchar(1000))

It works fine. So I am trying to force the variable to read that same way.

Here is my sorting code.

 void DataGrid_Sort(object sender, DataGridSortCommandEventArgs e)
  {

    DG1.CurrentPageIndex = 0;
    SortField = e.SortExpression;

    if (e.SortExpression == "Q_Text")
        {
        lbl.Text = "Yes";
        SortField = "Cast(Q_Text As varchar(1000))";
        }


    BindGrid();
  }



 protected String SortField {

    get {
        object o = ViewState["SortField"];
        return (o == null) ? String.Empty : (String)o;
    }
    set {
        ViewState["SortField"] = value;
    }
}

And here is the SQL Statement:

CommandText = "SELECT Q_Section As Section, Q_Text As Questions, Rating, Response FROM smileReportView WHERE ((H_CrsTitle = '"+ddlCourseList.SelectedItem.Value+"') and (Set_Name = '"+ddlSetList.SelectedItem.Value+"') and (Held_Key = '"+ddlHeldList.SelectedItem.Value+"') and (Rating = '"+ddlRatingList.SelectedItem.Text+"')) ORDER BY " + SortField;









Similar Threads
Thread Thread Starter Forum Replies Last Post
Large report in text box takabyte Beginning VB 6 3 August 6th, 2007 07:32 PM
How display large amount of dynamic text relaytest49 ASP.NET 2.0 Professional 2 October 6th, 2006 02:19 PM
Text/large varchar fields in SQL server pseudomorph Classic ASP Databases 0 August 16th, 2006 11:50 PM
Help with large amount of text and page breaks rwodabek BOOK: Professional SQL Server Reporting Services ISBN: 0-7645-6878-7 1 May 12th, 2006 07:49 AM
Parsing Large Delimited Text String Coop64 SQL Language 1 February 16th, 2004 03:19 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.