Ask a Question related to ASP.NET Data Grid Control, Design and Development.

  1. #1

    Default Sort datagrid

    Hello Group,
    I have a datagrid which needs to be sorted but the column
    headers should not be clickable on certain conditions( say on the
    "print version" of the page). The simple piece of code used is :

    dgwip.allowsorting=true
    dgWIP.DataSource = dvWIP
    dvWIP.Sort = Me.SortColumn & " " & Me.SortOrder
    dgWIP.DataBind()
    **dgwip.allowsorting=false

    Since, I need to sort the datagrid and disable the column headers
    after the sort, I disable the allowsorting property after the databind
    but that does not seem to do the job. Not sure, how to go about it.

    Any help would be great!!


    Thanks,
    Sam.
    sam Guest

  2. Similar Questions and Discussions

    1. sort in datagrid
      Hi, I have some columns in my datagrid which are date type. I want to sort on them. What would be the best way to do it. Based on a article to...
    2. Datagrid sort
      I have a datagrid that sorts. The sort doesn't seem to execute on my template column. It only works on my bound columns.
    3. bidirectional sort with datagrid
      Can someone show me how to turn this into a bi-directional sort allowing ascending and descending using the default datagrid allowsorting attribute?...
    4. datagrid won't sort
      I have a datagrid that won't sort. The event handler is firing and return label text, just not the sort. Here's my Sub Page_Load and Sub...
    5. Ado sort error-Ado Sort -Relate, Compute By, or Sort operations cannot be done on column(s) whose key length is unknown or exceeds 10 KB.
      Ado Sort -Relate, Compute By, or Sort operations cannot be done on column(s) whose key length is unknown or exceeds 10 KB. hi, guys i have asp...
  3. #2

    Default Re: Sort datagrid

    From your description, the special conditions that preclude sorting also
    require a post back or new page. If you can track when this is true, then
    you can disallow sorting. For example, the "Print Version" is obvoiusly a
    special case rendering of the page, so you can track it and disallow sorting
    when it is true.

    "sam" <sri_san@mailcity.com> wrote in message
    news:5ca7db4a.0409270520.da20980@posting.google.co m...
    > Hello Group,
    > I have a datagrid which needs to be sorted but the column
    > headers should not be clickable on certain conditions( say on the
    > "print version" of the page). The simple piece of code used is :
    >
    > dgwip.allowsorting=true
    > dgWIP.DataSource = dvWIP
    > dvWIP.Sort = Me.SortColumn & " " & Me.SortOrder
    > dgWIP.DataBind()
    > **dgwip.allowsorting=false
    >
    > Since, I need to sort the datagrid and disable the column headers
    > after the sort, I disable the allowsorting property after the databind
    > but that does not seem to do the job. Not sure, how to go about it.
    >
    > Any help would be great!!
    >
    >
    > Thanks,
    > Sam.

    Eric Guest

  4. #3

    Default Sort Datagrid

    Hi


    I have one question, can i sort DataGrid with two parameters ?
    that's mind if i have three columns in dataggrid: First Name, Last
    Name, Office

    John, Smith, New York
    John, Johnson, Oklahoma
    Jeff, Jhonson, New York
    Mug, Gates, New York

    and when i click sort to Office i have sorted data but i have on more
    Offices with this same Name, so i want when i sorted by Office the
    second parameters sort with example Last Name.

    The result i want:

    Mug, Gates, New York
    Jeff, Jhonson, New York
    John, Smith, New York
    John, Johnson, Oklahoma

    Big tx for all answers
    malin

    malin@o2.pl Guest

  5. #4

    Default Re: Sort Datagrid

    This functionality isn't built in, you will have to custom build it. One
    approach is to use the dataview object and pass in the multi-column sort
    critieria

    --
    Regards,
    Alvin Bruney [MVP ASP.NET]

    [Shameless Author plug]
    The Microsoft Office Web Components Black Book with .NET
    Now Available @ [url]www.lulu.com/owc[/url]
    Forth-coming VSTO.NET
    -------------------------------------------------------



    <malin@o2.pl> wrote in message
    news:1125318434.777853.55260@o13g2000cwo.googlegro ups.com...
    > Hi
    >
    >
    > I have one question, can i sort DataGrid with two parameters ?
    > that's mind if i have three columns in dataggrid: First Name, Last
    > Name, Office
    >
    > John, Smith, New York
    > John, Johnson, Oklahoma
    > Jeff, Jhonson, New York
    > Mug, Gates, New York
    >
    > and when i click sort to Office i have sorted data but i have on more
    > Offices with this same Name, so i want when i sorted by Office the
    > second parameters sort with example Last Name.
    >
    > The result i want:
    >
    > Mug, Gates, New York
    > Jeff, Jhonson, New York
    > John, Smith, New York
    > John, Johnson, Oklahoma
    >
    > Big tx for all answers
    > malin
    >

    Alvin Bruney - ASP.NET MVP Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139