473,471 Members | 2,138 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Is there a Namespace Reference somewhere?

jm
For example, I cannot get this to work (in my page_load on the
server):

chkCompleted.attributes.add("onclick", "javascript:return confirm('Are
you sure?');")

My code is:

<asp:datagrid....>
<columns>
some boundcolumns
<asp:Template ColumnHeaderText="Completed"
ItemStyle-HorizontalAlign="Center">
<ItemTemplate>
<asp:checkbox id="chkCompleted" Runat="server" />
</ItemTemplate>
</asp:TemplateColumn>
</columns>
</asp:datagrid>

I get an error that chkCompleted is not declared. My guess is that I
have not imported the correct namespace. I have tried several, just
guessing but I haven't found the right one.

Where is a good reference for this? Thank you and links are
appreciated.
Nov 17 '05 #1
1 917
Hi,

In fact , the WebControls in DataGrid Template Column appear another control
ID in client html.For example, if you put a "LinkButton1" in the Template
Column, in client side, the ID is auto changed to
"DataGrid1__ctl?_LinkButton1", so that you can't add attributes on ID
"LinkButton1" correctly.

Try to do this: during the event of DataGrid1_ItemDataBound, using
FindControl and add attributes dynamically.

Code:

private void DataGrid1_ItemDataBound(object sender,
System.Web.UI.WebControls.DataGridItemEventArgs e)
{
System.Web.UI.WebControls.LinkButton lLnkBtn_TargetButton;

if(e.Item.ItemType!=ListItemType.Header&&e.Item.It emType!=ListItemType.Foote
r)
{
lLnkBtn_TargetButton =
(System.Web.UI.WebControls.LinkButton)e.Item.Cells[2].FindControl("LinkButto
n1");
lLnkBtn_TargetButton.Attributes.Add("onclick","ret urn confirm(\"Are u
sure?\")");
}
}

Kosic
Nov 17 '05 #2

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

Similar topics

5
by: Blair Hall | last post by:
Can anyone please tell me how to correctly use a built in function when there is a function of the same name in local scope? Here is an example. Suppose the following is in myApply.py: def...
6
by: clinton__bill | last post by:
Hi, I usually use "using namespace <namespace_name>" to reference a namespace. Today I run across a code, in its header file it has this, namespace SP1{ class C1; } While SP1::C1 is a...
3
by: Alex Sedow | last post by:
Why MSVC# compiler in this error example say that 'A' is a namespace? 'A' is a class, not a namespace. // lookup5.cs namespace Lookup { namespace Case5 { class D : B {
14
by: Jon Rea | last post by:
I am currently cleaning up an application which was origainlly hashed together with speed of coding in mind and therefore contains quite a few "hacky" shortcuts. As part of this "revamping"...
0
by: A Wieser | last post by:
I've been trying to add support for localized error messages for my errorProviders. All the source code gives examples like this: errorProvider1->SetError(eventDescription, "You must enter a...
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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,...
1
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...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

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.