Removing columns from Gridview(2.0) databinding on templatefileds dont work?

Discussion in 'ASP .Net' started by Maarten, Apr 2, 2006.

  1. Maarten

    Maarten Guest

    Hi,

    I have a gridview (2.0), in the page load I remove a couple of columns from
    the gridview which I dont need.
    (All the columns are databound)
    This works fine. But after a postback all the templatefields are not bind
    anymore.
    Only the boundfields are still bound.
    Why? and what can I do about this?


    Many thanks,

    Page_Load:

    If Not IsPostBack Then

    'Loop to remove the extra columns we dont need:

    end if
     
    Maarten, Apr 2, 2006
    #1
    1. Advertising

  2. If you don't need them, remove from the design. This may actually help
    resolve your main issue.
    --
    Christopher A. Reed
    "The oxen are slow, but the earth is patient."

    "Maarten" <> wrote in message
    news:...
    > Hi,
    >
    > I have a gridview (2.0), in the page load I remove a couple of columns
    > from the gridview which I dont need.
    > (All the columns are databound)
    > This works fine. But after a postback all the templatefields are not bind
    > anymore.
    > Only the boundfields are still bound.
    > Why? and what can I do about this?
    >
    >
    > Many thanks,
    >
    > Page_Load:
    >
    > If Not IsPostBack Then
    >
    > 'Loop to remove the extra columns we dont need:
    >
    > end if
    >
     
    Christopher Reed, Apr 2, 2006
    #2
    1. Advertising

  3. Maarten

    Pipo Guest

    Hi Christopher,

    I understand that, but that's no option.
    I only know which one to remove at run-time, due to user selection.
    And not at design-time!




    "Christopher Reed" <> wrote in message
    news:...
    > If you don't need them, remove from the design. This may actually help
    > resolve your main issue.
    > --
    > Christopher A. Reed
    > "The oxen are slow, but the earth is patient."
    >
    > "Maarten" <> wrote in message
    > news:...
    >> Hi,
    >>
    >> I have a gridview (2.0), in the page load I remove a couple of columns
    >> from the gridview which I dont need.
    >> (All the columns are databound)
    >> This works fine. But after a postback all the templatefields are not bind
    >> anymore.
    >> Only the boundfields are still bound.
    >> Why? and what can I do about this?
    >>
    >>
    >> Many thanks,
    >>
    >> Page_Load:
    >>
    >> If Not IsPostBack Then
    >>
    >> 'Loop to remove the extra columns we dont need:
    >>
    >> end if
    >>

    >
    >
     
    Pipo, Apr 3, 2006
    #3
  4. Then, are you building your GridView in the Page_Load? If so, make sure the
    call to the DataBind method is not inside the If (!IsPostBack) clause.
    --
    Christopher A. Reed
    "The oxen are slow, but the earth is patient."

    "Pipo" <> wrote in message
    news:...
    > Hi Christopher,
    >
    > I understand that, but that's no option.
    > I only know which one to remove at run-time, due to user selection.
    > And not at design-time!
    >
    >
    >
    >
    > "Christopher Reed" <> wrote in message
    > news:...
    >> If you don't need them, remove from the design. This may actually help
    >> resolve your main issue.
    >> --
    >> Christopher A. Reed
    >> "The oxen are slow, but the earth is patient."
    >>
    >> "Maarten" <> wrote in message
    >> news:...
    >>> Hi,
    >>>
    >>> I have a gridview (2.0), in the page load I remove a couple of columns
    >>> from the gridview which I dont need.
    >>> (All the columns are databound)
    >>> This works fine. But after a postback all the templatefields are not
    >>> bind anymore.
    >>> Only the boundfields are still bound.
    >>> Why? and what can I do about this?
    >>>
    >>>
    >>> Many thanks,
    >>>
    >>> Page_Load:
    >>>
    >>> If Not IsPostBack Then
    >>>
    >>> 'Loop to remove the extra columns we dont need:
    >>>
    >>> end if
    >>>

    >>
    >>

    >
    >
     
    Christopher Reed, Apr 4, 2006
    #4
  5. Maarten

    Pipo Guest

    No, I am not doing that. It's already databound in design time(see OP)
    It is bound through a ObjectDataSources.



    "Christopher Reed" <> wrote in message
    news:...
    > Then, are you building your GridView in the Page_Load? If so, make sure
    > the call to the DataBind method is not inside the If (!IsPostBack) clause.
    > --
    > Christopher A. Reed
    > "The oxen are slow, but the earth is patient."
    >
    > "Pipo" <> wrote in message
    > news:...
    >> Hi Christopher,
    >>
    >> I understand that, but that's no option.
    >> I only know which one to remove at run-time, due to user selection.
    >> And not at design-time!
    >>
    >>
    >>
    >>
    >> "Christopher Reed" <> wrote in message
    >> news:...
    >>> If you don't need them, remove from the design. This may actually help
    >>> resolve your main issue.
    >>> --
    >>> Christopher A. Reed
    >>> "The oxen are slow, but the earth is patient."
    >>>
    >>> "Maarten" <> wrote in message
    >>> news:...
    >>>> Hi,
    >>>>
    >>>> I have a gridview (2.0), in the page load I remove a couple of columns
    >>>> from the gridview which I dont need.
    >>>> (All the columns are databound)
    >>>> This works fine. But after a postback all the templatefields are not
    >>>> bind anymore.
    >>>> Only the boundfields are still bound.
    >>>> Why? and what can I do about this?
    >>>>
    >>>>
    >>>> Many thanks,
    >>>>
    >>>> Page_Load:
    >>>>
    >>>> If Not IsPostBack Then
    >>>>
    >>>> 'Loop to remove the extra columns we dont need:
    >>>>
    >>>> end if
    >>>>
    >>>
    >>>

    >>
    >>

    >
    >
     
    Pipo, Apr 4, 2006
    #5
  6. Then, anytime you make a change to the GridView, you have to DataBind it
    again.
    --
    Christopher A. Reed
    "The oxen are slow, but the earth is patient."

    "Pipo" <> wrote in message
    news:...
    > No, I am not doing that. It's already databound in design time(see OP)
    > It is bound through a ObjectDataSources.
    >
    >
    >
    > "Christopher Reed" <> wrote in message
    > news:...
    >> Then, are you building your GridView in the Page_Load? If so, make sure
    >> the call to the DataBind method is not inside the If (!IsPostBack)
    >> clause.
    >> --
    >> Christopher A. Reed
    >> "The oxen are slow, but the earth is patient."
    >>
    >> "Pipo" <> wrote in message
    >> news:...
    >>> Hi Christopher,
    >>>
    >>> I understand that, but that's no option.
    >>> I only know which one to remove at run-time, due to user selection.
    >>> And not at design-time!
    >>>
    >>>
    >>>
    >>>
    >>> "Christopher Reed" <> wrote in message
    >>> news:...
    >>>> If you don't need them, remove from the design. This may actually help
    >>>> resolve your main issue.
    >>>> --
    >>>> Christopher A. Reed
    >>>> "The oxen are slow, but the earth is patient."
    >>>>
    >>>> "Maarten" <> wrote in message
    >>>> news:...
    >>>>> Hi,
    >>>>>
    >>>>> I have a gridview (2.0), in the page load I remove a couple of columns
    >>>>> from the gridview which I dont need.
    >>>>> (All the columns are databound)
    >>>>> This works fine. But after a postback all the templatefields are not
    >>>>> bind anymore.
    >>>>> Only the boundfields are still bound.
    >>>>> Why? and what can I do about this?
    >>>>>
    >>>>>
    >>>>> Many thanks,
    >>>>>
    >>>>> Page_Load:
    >>>>>
    >>>>> If Not IsPostBack Then
    >>>>>
    >>>>> 'Loop to remove the extra columns we dont need:
    >>>>>
    >>>>> end if
    >>>>>
    >>>>
    >>>>
    >>>
    >>>

    >>
    >>

    >
    >
     
    Christopher Reed, Apr 4, 2006
    #6
  7. Maarten

    Pipo Guest

    I will try that, thank you!


    "Christopher Reed" <> wrote in message
    news:%...
    > Then, anytime you make a change to the GridView, you have to DataBind it
    > again.
    > --
    > Christopher A. Reed
    > "The oxen are slow, but the earth is patient."
    >
    > "Pipo" <> wrote in message
    > news:...
    >> No, I am not doing that. It's already databound in design time(see OP)
    >> It is bound through a ObjectDataSources.
    >>
    >>
    >>
    >> "Christopher Reed" <> wrote in message
    >> news:...
    >>> Then, are you building your GridView in the Page_Load? If so, make sure
    >>> the call to the DataBind method is not inside the If (!IsPostBack)
    >>> clause.
    >>> --
    >>> Christopher A. Reed
    >>> "The oxen are slow, but the earth is patient."
    >>>
    >>> "Pipo" <> wrote in message
    >>> news:...
    >>>> Hi Christopher,
    >>>>
    >>>> I understand that, but that's no option.
    >>>> I only know which one to remove at run-time, due to user selection.
    >>>> And not at design-time!
    >>>>
    >>>>
    >>>>
    >>>>
    >>>> "Christopher Reed" <> wrote in message
    >>>> news:...
    >>>>> If you don't need them, remove from the design. This may actually
    >>>>> help resolve your main issue.
    >>>>> --
    >>>>> Christopher A. Reed
    >>>>> "The oxen are slow, but the earth is patient."
    >>>>>
    >>>>> "Maarten" <> wrote in message
    >>>>> news:...
    >>>>>> Hi,
    >>>>>>
    >>>>>> I have a gridview (2.0), in the page load I remove a couple of
    >>>>>> columns from the gridview which I dont need.
    >>>>>> (All the columns are databound)
    >>>>>> This works fine. But after a postback all the templatefields are not
    >>>>>> bind anymore.
    >>>>>> Only the boundfields are still bound.
    >>>>>> Why? and what can I do about this?
    >>>>>>
    >>>>>>
    >>>>>> Many thanks,
    >>>>>>
    >>>>>> Page_Load:
    >>>>>>
    >>>>>> If Not IsPostBack Then
    >>>>>>
    >>>>>> 'Loop to remove the extra columns we dont need:
    >>>>>>
    >>>>>> end if
    >>>>>>
    >>>>>
    >>>>>
    >>>>
    >>>>
    >>>
    >>>

    >>
    >>

    >
    >
     
    Pipo, Apr 5, 2006
    #7
  8. Maarten

    Pipo Guest

    Nope, not working either



    "Pipo" <> wrote in message
    news:...
    >I will try that, thank you!
    >
    >
    > "Christopher Reed" <> wrote in message
    > news:%...
    >> Then, anytime you make a change to the GridView, you have to DataBind it
    >> again.
    >> --
    >> Christopher A. Reed
    >> "The oxen are slow, but the earth is patient."
    >>
    >> "Pipo" <> wrote in message
    >> news:...
    >>> No, I am not doing that. It's already databound in design time(see OP)
    >>> It is bound through a ObjectDataSources.
    >>>
    >>>
    >>>
    >>> "Christopher Reed" <> wrote in message
    >>> news:...
    >>>> Then, are you building your GridView in the Page_Load? If so, make
    >>>> sure the call to the DataBind method is not inside the If (!IsPostBack)
    >>>> clause.
    >>>> --
    >>>> Christopher A. Reed
    >>>> "The oxen are slow, but the earth is patient."
    >>>>
    >>>> "Pipo" <> wrote in message
    >>>> news:...
    >>>>> Hi Christopher,
    >>>>>
    >>>>> I understand that, but that's no option.
    >>>>> I only know which one to remove at run-time, due to user selection.
    >>>>> And not at design-time!
    >>>>>
    >>>>>
    >>>>>
    >>>>>
    >>>>> "Christopher Reed" <> wrote in message
    >>>>> news:...
    >>>>>> If you don't need them, remove from the design. This may actually
    >>>>>> help resolve your main issue.
    >>>>>> --
    >>>>>> Christopher A. Reed
    >>>>>> "The oxen are slow, but the earth is patient."
    >>>>>>
    >>>>>> "Maarten" <> wrote in message
    >>>>>> news:...
    >>>>>>> Hi,
    >>>>>>>
    >>>>>>> I have a gridview (2.0), in the page load I remove a couple of
    >>>>>>> columns from the gridview which I dont need.
    >>>>>>> (All the columns are databound)
    >>>>>>> This works fine. But after a postback all the templatefields are not
    >>>>>>> bind anymore.
    >>>>>>> Only the boundfields are still bound.
    >>>>>>> Why? and what can I do about this?
    >>>>>>>
    >>>>>>>
    >>>>>>> Many thanks,
    >>>>>>>
    >>>>>>> Page_Load:
    >>>>>>>
    >>>>>>> If Not IsPostBack Then
    >>>>>>>
    >>>>>>> 'Loop to remove the extra columns we dont need:
    >>>>>>>
    >>>>>>> end if
    >>>>>>>
    >>>>>>
    >>>>>>
    >>>>>
    >>>>>
    >>>>
    >>>>
    >>>
    >>>

    >>
    >>

    >
    >
     
    Pipo, Apr 6, 2006
    #8
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Jacksm
    Replies:
    2
    Views:
    855
    Paul Chalekian
    Nov 21, 2006
  2. Bogdan
    Replies:
    0
    Views:
    590
    Bogdan
    Sep 29, 2008
  3. Maarten
    Replies:
    7
    Views:
    115
  4. Maarten
    Replies:
    7
    Views:
    129
  5. Pavel Tsekov
    Replies:
    0
    Views:
    177
    Pavel Tsekov
    Sep 14, 2006
Loading...

Share This Page