Disable objectdatasource-control

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Michael Fällgreen

    #1

    Disable objectdatasource-control

    Hi,

    I have a search page with a textbox, button, gridview and a
    objectdatasourc e. It works great with one problem. When the page loads the
    first time the objectdatasourc e calls the select-method and because its
    bound to the textbox (search string) and the textbox is empty it display all
    records. This is not the way I wnat it to work - however I want the user to
    be able to make a blank search (and return all items).

    Can I "disable" the datasource control on first load?

    Thanks


  • Cor Ligthert [MVP]

    #2
    Re: Disable objectdatasourc e-control

    Michael,

    There is nothing wrong with a switch if it is needed.

    But in the way you tell it am I asking myself why are you binding it in the
    load.
    (or are you binding it by the designer, have than just a look in the
    designer created code, and cut and paste that part there where you need it)

    Cor


    "Michael Fällgreen" <mfa@ulle.se> schreef in bericht
    news:eHcC7$IXGH A.4324@TK2MSFTN GP03.phx.gbl...[color=blue]
    > Hi,
    >
    > I have a search page with a textbox, button, gridview and a
    > objectdatasourc e. It works great with one problem. When the page loads the
    > first time the objectdatasourc e calls the select-method and because its
    > bound to the textbox (search string) and the textbox is empty it display
    > all records. This is not the way I wnat it to work - however I want the
    > user to be able to make a blank search (and return all items).
    >
    > Can I "disable" the datasource control on first load?
    >
    > Thanks
    >[/color]


    Comment

    • Michael Fällgreen

      #3
      Re: Disable objectdatasourc e-control

      Hi

      Im binding in the designer! How can I "make a switch"?

      Thanks


      "Cor Ligthert [MVP]" <notmyfirstname @planet.nl> skrev i en meddelelse
      news:%23YfWOqJX GHA.3660@TK2MSF TNGP04.phx.gbl. ..[color=blue]
      > Michael,
      >
      > There is nothing wrong with a switch if it is needed.
      >
      > But in the way you tell it am I asking myself why are you binding it in
      > the load.
      > (or are you binding it by the designer, have than just a look in the
      > designer created code, and cut and paste that part there where you need
      > it)
      >
      > Cor
      >
      >
      > "Michael Fällgreen" <mfa@ulle.se> schreef in bericht
      > news:eHcC7$IXGH A.4324@TK2MSFTN GP03.phx.gbl...[color=green]
      >> Hi,
      >>
      >> I have a search page with a textbox, button, gridview and a
      >> objectdatasourc e. It works great with one problem. When the page loads
      >> the first time the objectdatasourc e calls the select-method and because
      >> its bound to the textbox (search string) and the textbox is empty it
      >> display all records. This is not the way I wnat it to work - however I
      >> want the user to be able to make a blank search (and return all items).
      >>
      >> Can I "disable" the datasource control on first load?
      >>
      >> Thanks
      >>[/color]
      >
      >[/color]


      Comment

      • Cor Ligthert [MVP]

        #4
        Re: Disable objectdatasourc e-control

        Michael,

        If you are binding in the designer than the binding is done while
        initializing.

        What version are you using? (1.x or 2.0)

        Cor

        "Michael Fällgreen" <mfa@ulle.se> schreef in bericht
        news:e5dE8xJXGH A.1200@TK2MSFTN GP03.phx.gbl...[color=blue]
        > Hi
        >
        > Im binding in the designer! How can I "make a switch"?
        >
        > Thanks
        >
        >
        > "Cor Ligthert [MVP]" <notmyfirstname @planet.nl> skrev i en meddelelse
        > news:%23YfWOqJX GHA.3660@TK2MSF TNGP04.phx.gbl. ..[color=green]
        >> Michael,
        >>
        >> There is nothing wrong with a switch if it is needed.
        >>
        >> But in the way you tell it am I asking myself why are you binding it in
        >> the load.
        >> (or are you binding it by the designer, have than just a look in the
        >> designer created code, and cut and paste that part there where you need
        >> it)
        >>
        >> Cor
        >>
        >>
        >> "Michael Fällgreen" <mfa@ulle.se> schreef in bericht
        >> news:eHcC7$IXGH A.4324@TK2MSFTN GP03.phx.gbl...[color=darkred]
        >>> Hi,
        >>>
        >>> I have a search page with a textbox, button, gridview and a
        >>> objectdatasourc e. It works great with one problem. When the page loads
        >>> the first time the objectdatasourc e calls the select-method and because
        >>> its bound to the textbox (search string) and the textbox is empty it
        >>> display all records. This is not the way I wnat it to work - however I
        >>> want the user to be able to make a blank search (and return all items).
        >>>
        >>> Can I "disable" the datasource control on first load?
        >>>
        >>> Thanks
        >>>[/color]
        >>
        >>[/color]
        >
        >[/color]


        Comment

        • Michael Fällgreen

          #5
          Re: Disable objectdatasourc e-control

          2.0

          Michael
          "Cor Ligthert [MVP]" <notmyfirstname @planet.nl> skrev i en meddelelse
          news:ui368BKXGH A.5024@TK2MSFTN GP04.phx.gbl...[color=blue]
          > Michael,
          >
          > If you are binding in the designer than the binding is done while
          > initializing.
          >
          > What version are you using? (1.x or 2.0)
          >
          > Cor
          >
          > "Michael Fällgreen" <mfa@ulle.se> schreef in bericht
          > news:e5dE8xJXGH A.1200@TK2MSFTN GP03.phx.gbl...[color=green]
          >> Hi
          >>
          >> Im binding in the designer! How can I "make a switch"?
          >>
          >> Thanks
          >>
          >>
          >> "Cor Ligthert [MVP]" <notmyfirstname @planet.nl> skrev i en meddelelse
          >> news:%23YfWOqJX GHA.3660@TK2MSF TNGP04.phx.gbl. ..[color=darkred]
          >>> Michael,
          >>>
          >>> There is nothing wrong with a switch if it is needed.
          >>>
          >>> But in the way you tell it am I asking myself why are you binding it in
          >>> the load.
          >>> (or are you binding it by the designer, have than just a look in the
          >>> designer created code, and cut and paste that part there where you need
          >>> it)
          >>>
          >>> Cor
          >>>
          >>>
          >>> "Michael Fällgreen" <mfa@ulle.se> schreef in bericht
          >>> news:eHcC7$IXGH A.4324@TK2MSFTN GP03.phx.gbl...
          >>>> Hi,
          >>>>
          >>>> I have a search page with a textbox, button, gridview and a
          >>>> objectdatasourc e. It works great with one problem. When the page loads
          >>>> the first time the objectdatasourc e calls the select-method and because
          >>>> its bound to the textbox (search string) and the textbox is empty it
          >>>> display all records. This is not the way I wnat it to work - however I
          >>>> want the user to be able to make a blank search (and return all items).
          >>>>
          >>>> Can I "disable" the datasource control on first load?
          >>>>
          >>>> Thanks
          >>>>
          >>>
          >>>[/color]
          >>
          >>[/color]
          >
          >[/color]


          Comment

          • Cor Ligthert [MVP]

            #6
            Re: Disable objectdatasourc e-control

            Michael,

            GridView I was aspectiong you were using windowsforms.

            In this case I would simple try in the load event

            if not ispostback then
            GridView1.Datas ource = nothing
            end if

            Not tried, I would not know why this would not work.

            Cor


            Comment

            Working...