Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Web Controls > InputAttributes in RowCreated (gridview)

Reply
Thread Tools

InputAttributes in RowCreated (gridview)

 
 
Pipo
Guest
Posts: n/a
 
      03-31-2006
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




 
Reply With Quote
 
 
 
 
Teemu Keiski
Guest
Posts: n/a
 
      04-01-2006
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
>
>
>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
GridView RowCreated Handler Issues bigbrorpi@gmail.com ASP .Net 2 10-25-2007 04:05 PM
GridView - RowCreated EventHandler doesn't work if page IsPostBack Paul ASP .Net 2 04-29-2007 01:48 PM
Gridview RowCreated - way to change just first row command text? K B ASP .Net 1 06-06-2006 03:56 PM
InputAttributes in RowCreated (gridview) Pipo ASP .Net Datagrid Control 1 04-01-2006 05:28 PM
InputAttributes in RowCreated (gridview) Pipo ASP .Net 1 04-01-2006 05:28 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57