checkbox databind does not work

Discussion in 'ASP .Net Datagrid Control' started by Jim, Jan 5, 2005.

  1. Jim

    Jim Guest

    i am trying to bind a checkbox to a tablecolumn available (integer)

    i get an error:

    'The best overloaded method match for Company.Customers.fbool(int)' has some
    invalid arguments'


    datagrid:

    <asp:DataGrid..>

    <Columns>

    <asp:TemplateColumn HeaderText="available">
    <ItemTemplate>
    <asp:CheckBox id="cbAvailable"
    Checked='<%#fbool(DataBinder.Eval(Container, "DataItem.available"))%>'
    Runat="server"></asp:CheckBox>
    </ItemTemplate>
    </asp:TemplateColumn>



    <Columns>

    </asp:DataGrid..>



    fbool function:

    public string fbool(int i)

    {

    if (i==1)

    {

    return "true";

    }

    else

    {

    return "false";

    }

    }



    thanks



    Jim
     
    Jim, Jan 5, 2005
    #1
    1. Advertising

  2. Jim

    Jim Guest

    nevermind got it
    "Jim" <> wrote in message
    news:...
    > i am trying to bind a checkbox to a tablecolumn available (integer)
    >
    > i get an error:
    >
    > 'The best overloaded method match for Company.Customers.fbool(int)' has

    some
    > invalid arguments'
    >
    >
    > datagrid:
    >
    > <asp:DataGrid..>
    >
    > <Columns>
    >
    > <asp:TemplateColumn HeaderText="available">
    > <ItemTemplate>
    > <asp:CheckBox id="cbAvailable"
    > Checked='<%#fbool(DataBinder.Eval(Container, "DataItem.available"))%>'
    > Runat="server"></asp:CheckBox>
    > </ItemTemplate>
    > </asp:TemplateColumn>
    >
    >
    >
    > <Columns>
    >
    > </asp:DataGrid..>
    >
    >
    >
    > fbool function:
    >
    > public string fbool(int i)
    >
    > {
    >
    > if (i==1)
    >
    > {
    >
    > return "true";
    >
    > }
    >
    > else
    >
    > {
    >
    > return "false";
    >
    > }
    >
    > }
    >
    >
    >
    > thanks
    >
    >
    >
    > Jim
    >
    >
     
    Jim, Jan 5, 2005
    #2
    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. aualias

    How do you databind a CheckBox?

    aualias, May 25, 2004, in forum: ASP .Net
    Replies:
    11
    Views:
    21,749
    npclaudiu
    Apr 29, 2011
  2. jasonkester

    checkbox databind does not work

    jasonkester, Jan 4, 2005, in forum: ASP .Net
    Replies:
    5
    Views:
    6,222
  3. =?Utf-8?B?TWFyayBMZWlzdG5lcg==?=

    Does GridView.DataBind work under medium trust with custom objects

    =?Utf-8?B?TWFyayBMZWlzdG5lcg==?=, Aug 22, 2006, in forum: ASP .Net
    Replies:
    3
    Views:
    524
    =?Utf-8?B?TWFyayBMZWlzdG5lcg==?=
    Aug 23, 2006
  4. =?Utf-8?B?cm9kY2hhcg==?=

    checkbox databind

    =?Utf-8?B?cm9kY2hhcg==?=, Nov 10, 2006, in forum: ASP .Net
    Replies:
    5
    Views:
    487
    Mark Rae
    Nov 10, 2006
  5. Michael
    Replies:
    0
    Views:
    245
    Michael
    Dec 29, 2003
Loading...

Share This Page