473,405 Members | 2,171 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

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


Mar 31 '06 #1
1 1792
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" <No****@me.com> wrote in message
news:eJ**************@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

Apr 1 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Nalaka | last post by:
Hi, I have a gridView (grid1), which as a templateColumn. In the template column, I have put in a gridView (grid2) and a ObjectDataSource (objectDataSource2). Question is... How to I pass the...
5
by: Dick | last post by:
I have a GridView bound to an ObjectDataSource. I have a Button that calls GridView.DataBind. I want the row that is selected before the DataBind to still be selected afterwards. This happens...
1
by: bigbrorpi | last post by:
I'm having a problem with a Gridview bound to an objectdatasource. I've created a handler for onRowCreated with something as simple as: msgbox(e.row.cells(1).text) When the page loads, I see...
1
by: K B | last post by:
Hi, Is there a way to change the EditText value on just the commandfield in the first row. In the RowCreated event... If e.Row.RowIndex = 0 Then ...change the edittext on the commandfield ...
2
by: Paul | last post by:
Hello All, I am trying to use the following RowCreated Event Handler to make the BackColor of a cell different if it has a particular value. protected void GridView1_RowCreated(object sender,...
11
by: giveDsolution | last post by:
Hope to find the Solution, My requirment is, I have set AutoGenerateColumns=True for a gridview as i have to add columns at runtime. My first question is: How to hide a column ? And my second...
0
by: =?Utf-8?B?YmVuamk=?= | last post by:
Hi, I've got a gridview that I bind programmatically to a view of a typed dataset. One column has a command button, and in the RowCreated event, I test to see if it's a DataRow, and if it is, I...
0
by: Bogdan | last post by:
Hi, I need to modify gridview footer so it consists only of a single column that spans all data columns in a gridview. I first tried DataBound() event (as per suggestion found on the Net) but...
9
by: ally | last post by:
Hi, I am programmatically binding gridview to a datatable. I want to hide 2 columns. I can be done by adding code in RowCreated event of gridview like e.Row.Cells.Visible = false; ...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.