|
code
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
InputAttributes in RowCreated (gridview)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 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. Show quoteHide quote "Pipo" <NoS***@me.com> wrote in message news:eJ9riuOVGHA.4300@TK2MSFTNGP14.phx.gbl... > 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 > > > >
Problem with User Control and unset references to controls within
GridView - can't reference value of a non-visible cell?? error in adding user controls at runtime Fitting a table inside an ASP Panel error using .NET CrystalReportViewer (.NET 1.1 VS.NET 2003) Gridview PostBack Problems Image Server Control's Style/Border WebControl rendering in frontpage 2003 - Migrating from Visual Studio 2003 to 2005 GridView Height Re: Binding two fields in the DataNavigateUrlFormatString |
|||||||||||||||||||||||