C#/ObjectDataSource/Gridview DropDownList or CheckBox

Last post 06-15-2009 5:00 AM by julien_h. 7 replies.

Sort Posts:

  • C#/ObjectDataSource/Gridview DropDownList or CheckBox

    08-04-2008, 5:58 PM
    • Member
      9 point Member
    • Zimbran
    • Member since 07-27-2008, 9:00 PM
    • Posts 40
     Still trying to get my ObjetDataSource project with GridView to work as I would like it to work.  I would like the DropDownList to show the value from one of the columns in the GridView? If the value is 0 = “No” or if the value is 1 = “Yes” I have goolgled this but can’t find any good example. Do you have a simple example for the DropDownList  (or the CheckBox would work fine too).

     

  • Re: C#/ObjectDataSource/Gridview DropDownList or CheckBox

    08-04-2008, 6:05 PM
    Answer
    • All-Star
      23,823 point All-Star
    • pkellner
    • Member since 11-12-2004, 10:42 AM
    • San Jose, California
    • Posts 3,579
    • ASPInsiders
      Moderator
      TrustedFriends-MVPs

    here is a post I did.

    http://peterkellner.net/2007/12/13/gridviewdropdownlistrow/

    <asp:DropDownList ID="DropDownListUser" runat="server" AutoPostBack="False" DataSourceID="SqlDataSourceUser" 

                DataTextField="Username" DataValueField="id" SelectedValue='<%# Bind("TemplateUsersId") %>'

             </asp:DropDownList> 

    Peter Kellner
    http://peterkellner.net
    Microsoft MVP • ASPInsider
  • Re: C#/ObjectDataSource/Gridview DropDownList or CheckBox

    08-05-2008, 6:17 PM
    • Member
      9 point Member
    • Zimbran
    • Member since 07-27-2008, 9:00 PM
    • Posts 40

    I can’t get it to work.  In need an example where the DataSource is an ObjectDataSource…

  • Re: C#/ObjectDataSource/Gridview DropDownList or CheckBox

    08-05-2008, 7:58 PM
    • All-Star
      23,823 point All-Star
    • pkellner
    • Member since 11-12-2004, 10:42 AM
    • San Jose, California
    • Posts 3,579
    • ASPInsiders
      Moderator
      TrustedFriends-MVPs
    Peter Kellner
    http://peterkellner.net
    Microsoft MVP • ASPInsider
  • Re: C#/ObjectDataSource/Gridview DropDownList or CheckBox

    08-06-2008, 7:28 AM
    • Member
      9 point Member
    • Zimbran
    • Member since 07-27-2008, 9:00 PM
    • Posts 40

    Thank you! Yes Your post and code example helped me to solve my problem.

     

    Now I have to try to get the ItemTemplate with a label to show me the “Yes” and “No” for True and False… idea?
  • Re: C#/ObjectDataSource/Gridview DropDownList or CheckBox

    08-06-2008, 10:11 AM
    Answer
    • All-Star
      23,823 point All-Star
    • pkellner
    • Member since 11-12-2004, 10:42 AM
    • San Jose, California
    • Posts 3,579
    • ASPInsiders
      Moderator
      TrustedFriends-MVPs

    You are most welcome!

    Here is another post to explain that.

    http://peterkellner.net/2008/08/06/assign-label-in-aspdotnet-to-gridview-in-objectdatasource/

     

    Peter Kellner
    http://peterkellner.net
    Microsoft MVP • ASPInsider
  • Re: C#/ObjectDataSource/Gridview DropDownList or CheckBox

    08-06-2008, 10:43 AM
    • Member
      9 point Member
    • Zimbran
    • Member since 07-27-2008, 9:00 PM
    • Posts 40
    Thank you again! Yes I really appreciate that you took the time to explain this to me (and all the other readers of the forum). This solved my problem and now I can concentrate on other tasks in my project instead of searching for more examples that doesn’t help (I have searched a lot on different forums). I like your approach when you helped me. Some explanation in text and code example is very helpful when you are stuck and can’t see clearly at your own code.

     

  • Re: C#/ObjectDataSource/Gridview DropDownList or CheckBox

    06-15-2009, 5:00 AM
    • Member
      4 point Member
    • julien_h
    • Member since 06-09-2009, 4:26 AM
    • Posts 2

    Hello , I  have this task to do and I can't seem to figure it out .

    I have to  show  based on my database the number and title of books that every author has based on his ID .

    how can I do that using Gridview ?  

    thank you for your help and plzzz it's kinda urgent !!!!!!!!!

Page 1 of 1 (8 items)