Help with GridView

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • =?Utf-8?B?TWl0Y2hX?=

    Help with GridView

    Hello,

    I am am having trouble with the GridView control in conjunction with a
    SQLDataSource control with ASP .NET 3.5 and C#. When the form loads I want
    the current GirdView to only display information from the logged in user. (I
    can do this with a SessionParamete r no problem). Now I would like a button on
    the form that removes the parameter so that all records are shown. This is
    whew my problem come in. I could not figure out a way to do it so I thought I
    would create the SelectCommand in C# code and change the select command based
    on whether or not the box was checked or not. This works, except when I use
    paging or when I click a sort column, then no record are returned.

    Somehow it appears it is losing the SelectCommand altogether.

    I would prefer not to use a FilterParameter as the dataset is very large.
    What am I missing?

    thanks in advance,
    mitch
  • Eliyahu Goldin

    #2
    Re: Help with GridView

    Add another parameter to the SelectParameter s:
    <SelectParamete rs>
    ....
    <asp:controlpar ameter name="GetAll" controlid="chec kboxShowAll"
    propertyname="C hecked"/>
    </SelectParameter s>

    Modify your select to have something like
    WHERE user_id = @UserId or @GetAll = 1

    --
    Eliyahu Goldin,
    Software Developer
    Microsoft MVP [ASP.NET]




    "MitchW" <MitchW@discuss ions.microsoft. comwrote in message
    news:5A9766A8-CB8A-4EED-BE5E-83E4347F92D6@mi crosoft.com...
    Hello,
    >
    I am am having trouble with the GridView control in conjunction with a
    SQLDataSource control with ASP .NET 3.5 and C#. When the form loads I want
    the current GirdView to only display information from the logged in user.
    (I
    can do this with a SessionParamete r no problem). Now I would like a button
    on
    the form that removes the parameter so that all records are shown. This is
    whew my problem come in. I could not figure out a way to do it so I
    thought I
    would create the SelectCommand in C# code and change the select command
    based
    on whether or not the box was checked or not. This works, except when I
    use
    paging or when I click a sort column, then no record are returned.
    >
    Somehow it appears it is losing the SelectCommand altogether.
    >
    I would prefer not to use a FilterParameter as the dataset is very large.
    What am I missing?
    >
    thanks in advance,
    mitch

    Comment

    Working...