InputAttributes in RowCreated (gridview)

Discussion in 'ASP .Net Datagrid Control' started by Pipo, Mar 31, 2006.

  1. Pipo

    Pipo Guest

    Hi,

    I want to bind my checkboxes during Rowcreated in the gridview.
    I want to render:
    <asp:CheckBox ID="chkDIS1" runat="server" Checked='<%# Bind("DIS1") %>' />
    I tried:
    chk.InputAttributes.Add("Checked", "'<%# Bind(""" + "DIS" +
    dtt.Rows(intRowCounter).Item(0).ToString + """)" + "%>'")
    But then I get Checked="'<%# Bind("DIS1") %>'" notice the extra " before and
    after '<%# Bind("DIS1") %>'
    also
    chk.InputAttributes.Add("Checked='<%# Bind(""" + "SID" +
    dtt.Rows(intRowCounter).Item(0).ToString + """)" + "%>'", Nothing)
    But this does nothing.
    Does anybody knows how to do this?

    tia
     
    Pipo, Mar 31, 2006
    #1
    1. Advertising

  2. Pipo

    Teemu Keiski Guest

    Hi,

    adding these in code via Attributes collection doesn't do anything. <%# ...
    %> syntax is meaningful only to the page parser when Page is parsed from
    declarative syntax (that is aspx, ascx etc). If you want to set these in
    code, you'd do that in RowDataBound event, and access straight GridViewRow's
    DataItem property which represents the single data item for that particular
    row.

    --
    Teemu Keiski
    ASP.NET MVP, AspInsider
    Finland, EU
    http://blogs.aspadvice.com/joteke


    "Pipo" <> wrote in message
    news:...
    > Hi,
    >
    > I want to bind my checkboxes during Rowcreated in the gridview.
    > I want to render:
    > <asp:CheckBox ID="chkDIS1" runat="server" Checked='<%# Bind("DIS1") %>' />
    > I tried:
    > chk.InputAttributes.Add("Checked", "'<%# Bind(""" + "DIS" +
    > dtt.Rows(intRowCounter).Item(0).ToString + """)" + "%>'")
    > But then I get Checked="'<%# Bind("DIS1") %>'" notice the extra " before
    > and after '<%# Bind("DIS1") %>'
    > also
    > chk.InputAttributes.Add("Checked='<%# Bind(""" + "SID" +
    > dtt.Rows(intRowCounter).Item(0).ToString + """)" + "%>'", Nothing)
    > But this does nothing.
    > Does anybody knows how to do this?
    >
    > tia
    >
    >
    >
    >
     
    Teemu Keiski, Apr 1, 2006
    #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. Pipo
    Replies:
    1
    Views:
    666
    Teemu Keiski
    Apr 1, 2006
  2. Replies:
    2
    Views:
    3,316
    fiendiest
    Oct 25, 2007
  3. K B
    Replies:
    1
    Views:
    12,321
    PeterKellner
    Jun 6, 2006
  4. Paul
    Replies:
    2
    Views:
    2,928
  5. Pipo

    InputAttributes in RowCreated (gridview)

    Pipo, Mar 31, 2006, in forum: ASP .Net Web Controls
    Replies:
    1
    Views:
    182
    Teemu Keiski
    Apr 1, 2006
Loading...

Share This Page