473,396 Members | 1,921 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,396 software developers and data experts.

Problem adding an attribute to a web form control after posting ba

Hi all...

I have the following curious problem,

I have a GridView that I bind after I press a button in the web form. That
grid has a template column, which contains a checkbox (in the header and in
each row). The grid view is configured to be sortable.

These are the event handlers that causes the post back (click for the button
and when the grid has to be sorted)

protected void btnCargar_Click(object sender, EventArgs e)
{
ViewState["sort_expresion"] = "NUMPOL";
ViewState["sort_direction"] = "";

RefreshdataGrid();
}
protected void gvClaveInternet_Sorting(object sender,
GridViewSortEventArgs e)
{
ViewState["sort_expresion"] = e.SortExpression;
ViewState["sort_direction"] = e.SortDirection;

RefreshdataGrid();
}

RefreshdataGrid( ) method contains this code :

((CheckBox)gvClaveInternet.HeaderRow.Cells[0].Controls[1]).Attributes.Add("onclick", "check_all();");
foreach (GridViewRow row in gvClaveInternet.Rows)
((CheckBox)row.Cells[0].Controls[1]).Attributes.Add("onclick",
"row_click();");

btnDesmarcar.Attributes.Add("onclick", "return confirm('¿Está seguro que
desea proceder?');");
Well... when the page is loaded after btnCargar_Click event occurs,
"onclick" attribute is correctly added to the checkboxes, but when I press
some header text in order to sort by that column and the page is refreshed,
the "onclick" attribute isn't added to the checkboxes, but it is added for
btnDesmarcar button, so it's a problem only for the checkboxes.

When I debug the application, I see that the code is correctly executed.

What may be hapenning?
Thanks in advance

Jaime
Dec 14 '05 #1
0 1030

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

Similar topics

7
by: Aaron Prohaska | last post by:
I have just run into a problem where I have a page that posts back to itself to execute code, except when the page does the post back it somehow executes code that is in our home page for the site....
6
by: Robin Bonin | last post by:
In my user contol I am creating a set of dropdownlists. Each list is created based on input from the other lists. The problem I am having is setting the selected index on the lists. If someone...
3
by: Robert Bull | last post by:
I am trying to add a radio button at runtime in an asp.net web form but I keep getting the error message "type 'RadioButton' must be placed inside a form tag with runat=server". I use the following...
3
by: Ankit Aneja | last post by:
I have a strange situation and I have no idea how to solve this. Its a Recruitment Search Page,in the Admin Page, for every button click event the Admin Person has to create a checkbox on the users...
7
by: Trickynick1001 | last post by:
Hi, a newbie here. I don't have a real firm grasp on the idea of Javascript, as I'm used to programming in Qbasic and C. I'm not used to OOP. Anyway, I really don't have any idea what the...
6
by: Joel | last post by:
2 Questions: (1) The documentation says application.run() creates a standard message loop on the current thread and "optionally" shows a form. This is really confusing because I was of the...
12
by: Ron M. Newman | last post by:
Hi, I can load an assembly using the Assembly.Load(....) However, I'd like dynamic loading of assemblies to be identical to putting an assembly reference in your VS2005 project. and yes, I...
3
by: Jonathan Wood | last post by:
I could really use some help on this. First of all, I want to create a Web control where I render the control completely from scratch based on information from a database. In the book...
3
by: Tomasz J | last post by:
Hello Developers, I have a control derived from System.Web.UI.WebControls.WebControl. Control has this property: public string Value { set { _value = value; } get { return _value; }
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
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
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.