473,581 Members | 2,497 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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,
GridViewSortEve ntArgs e)
{
ViewState["sort_expresion "] = e.SortExpressio n;
ViewState["sort_direction "] = e.SortDirection ;

RefreshdataGrid ();
}

RefreshdataGrid ( ) method contains this code :

((CheckBox)gvCl aveInternet.Hea derRow.Cells[0].Controls[1]).Attributes.Ad d("onclick", "check_all();") ;
foreach (GridViewRow row in gvClaveInternet .Rows)
((CheckBox)row. Cells[0].Controls[1]).Attributes.Ad d("onclick",
"row_click();") ;

btnDesmarcar.At tributes.Add("o nclick", "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 1038

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

Similar topics

7
2299
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. The only reason I know that is happening is because I keep track of the pages executed by the user to see how they have traversed the site. Has...
6
6999
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 changes box1, I want to set the selected index in box2 = 0. When I do this, I dont get an error, but when the page loads, it still has the selected...
3
1379
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 code: Dim rbYes As New RadioButton() dim sStyle as string sStyle = "POSITION:absolute; TOP: 250px; LEFT: 10px" rbYes.Attributes.Add("style",...
3
2335
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 page. So whenever the Admin person comes to know about the new category in the market he will be adding as different Sub-Categories for example...
7
1767
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 problem is with this code, it just simply won't work properly. Some of the functions aren't done, but the main one gives me a Not a Number message in the...
6
2001
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 understanding that application.run() creates a message loop for the form and passes all messages to it. If showing the form is optional, and I want to...
12
1703
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 know about the unloading problems. Let's say I don't care for the moment. If I have an assemlbly file at "c:\\assembly.dll" - how do I load it at...
3
1871
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 "Beginning ASP.NET 2.0 in C# 2005", it provides an example of doing this, which is declared as: public class ConfigurableRepeater : WebControl.
3
1420
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
7868
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
8149
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
1
7899
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
8175
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6553
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5674
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5364
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3827
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1403
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.