Saturday, March 31, 2012
Strange Behavior
If I click the html tab to go to html view, then click the Design tab again, the control shows just fine (like a regular textbox).
Is there some event I am missing or a property that needs to be set?
The top is what is looks like when I place the control on the form.
The bottom is what it looks like when I go to html view and then back to design view...
http://vbforums.com/attachment.php?s=&postid=1669737
Any Ideas what is going on?Solution: I had to override the render event.
Like this
Protected Overrides Sub render(output As HtmlTextWriter)
EnsureChildControls()
MyBase.Render()
End Sub
Strange behavior
I have a strange behaviour in my asp.net web page. My page
contains a datagrid control, which has another nested
datagrid as a user control. It works very well, when the
user expands the + button or closes it with the same
buton. However when I do this several times successively
then suddenly I got the error message:
Object reference not set to an instance of an object.
objGetDailyStoreQuantitySold.StartDate = CType(e.Item.Cells
(0).FindControl("lblInvoiceDate"), Label).Text
When I do a refresh then it sees the label control again.
I am somehow
help?
ThanksBy looking at this code, all one could really say is that:
objGetDailyStoreQuantitySold could be Nothing.
e could be Nothing.
e.Item could be Nothing
e.Item.Cells could be Nothing
...
etc.
You'll need to show a little more code or step through with a debugger
to get more details. Know what I mean?
Scott
http://www.OdeToCode.com/blogs/scott/
On Thu, 10 Feb 2005 08:01:10 -0800, "anonymous"
<anonymous@.discussions.microsoft.com> wrote:
>Hello guys,
>I have a strange behaviour in my asp.net web page. My page
>contains a datagrid control, which has another nested
>datagrid as a user control. It works very well, when the
>user expands the + button or closes it with the same
>buton. However when I do this several times successively
>then suddenly I got the error message:
>Object reference not set to an instance of an object.
>objGetDailyStoreQuantitySold.StartDate = CType(e.Item.Cells
>(0).FindControl("lblInvoiceDate"), Label).Text
>
>When I do a refresh then it sees the label control again.
>I am somehow
>help?
>Thanks
Strange behavior
I have a strange behaviour in my asp.net web page. My page
contains a datagrid control, which has another nested
datagrid as a user control. It works very well, when the
user expands the + button or closes it with the same
buton. However when I do this several times successively
then suddenly I got the error message:
Object reference not set to an instance of an object.
objGetDailyStoreQuantitySold.StartDate = CType(e.Item.Cells
(0).FindControl("lblInvoiceDate"), Label).Text
When I do a refresh then it sees the label control again.
I am somehow confused why this is happening. Can somebody
help?
ThanksBy looking at this code, all one could really say is that:
objGetDailyStoreQuantitySold could be Nothing.
e could be Nothing.
e.Item could be Nothing
e.Item.Cells could be Nothing
...
etc.
You'll need to show a little more code or step through with a debugger
to get more details. Know what I mean?
--
Scott
http://www.OdeToCode.com/blogs/scott/
On Thu, 10 Feb 2005 08:01:10 -0800, "anonymous"
<anonymous@.discussions.microsoft.com> wrote:
>Hello guys,
>I have a strange behaviour in my asp.net web page. My page
>contains a datagrid control, which has another nested
>datagrid as a user control. It works very well, when the
>user expands the + button or closes it with the same
>buton. However when I do this several times successively
>then suddenly I got the error message:
>Object reference not set to an instance of an object.
>objGetDailyStoreQuantitySold.StartDate = CType(e.Item.Cells
>(0).FindControl("lblInvoiceDate"), Label).Text
>
>When I do a refresh then it sees the label control again.
>I am somehow confused why this is happening. Can somebody
>help?
>Thanks
Wednesday, March 28, 2012
Strange Custom Control Problem (.Net 2.0)
I have a control derived from System.Web.UI.WebControls.WebControl. Control
has this property:
[Bindable(true), Category("Misc"), Description("value")]
public string Value
{
set { _value = value; }
get { return _value; }
}
protected override void AddAttributesToRender(HtmlTextWriter writer)
{
base.AddAttributesToRender(writer);
writer.AddAttribute("alt", _value);
}
I use my control like this:
<mc:MyControl ID="MyControl" Value="<%=Value %>" runat="server" />
(the page class has protected Value property)
There are no compilation problems, but ASP.Net incorrectly renders alt
attribute:
alt="<%=Value %>"
It seems like it is a problem at compile-time. I cannot use expressions in
control attribute values.
What could be wrong with this picture?
Any hints highly appreciated.
Tomasz JHi Tomasz,
As for the problem you met, it is due to the limitation of expression that
can be used inside ASP.NET server control attribute/tag. The <%= %>
expression is brought from classic ASP for compatible purpose and can only
be used in plain html fragment(at top level of aspx page or ascx user
control).
For ASP.NET server control tag, you can consider the following means to
embed dynamic value:
1. Use <%# ... %> like databinding expression, however, you need to call
control.DataBind() at runtime (in page load or init ...) so as to make the
databinding expression get evaluated.
2. In ASP.NET 2.0, there provides a custom Expression Builder
functionality, that can help you define your own custom expression(can be
used inside server control tag/attributes). Here are some articles
introducing this:
#The CodeExpressionBuilder
http://weblogs.asp.net/infinitieslo...CodeExpressionB
uilder.aspx
http://weblogs.asp.net/leftslipper/archive/2007/01.aspx
Hope this helps.
Sincerely,
Steven Cheng
Microsoft MSDN Online Support Lead
========================================
==========
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscript...ault.aspx#notif
ications.
Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscript...t/default.aspx.
========================================
==========
This posting is provided "AS IS" with no warranties, and confers no rights.
--
>From: "Tomasz J" <oegweb@.nospam.nospam>
>Subject: Strange Custom Control Problem (.Net 2.0)
>Date: Wed, 9 Jan 2008 02:15:06 +0100
>Hello Developers,
>I have a control derived from System.Web.UI.WebControls.WebControl.
Control
>has this property:
>[Bindable(true), Category("Misc"), Description("value")]
>public string Value
>{
> set { _value = value; }
> get { return _value; }
>}
>protected override void AddAttributesToRender(HtmlTextWriter writer)
>{
> base.AddAttributesToRender(writer);
> writer.AddAttribute("alt", _value);
>}
>I use my control like this:
><mc:MyControl ID="MyControl" Value="<%=Value %>" runat="server" />
>(the page class has protected Value property)
>There are no compilation problems, but ASP.Net incorrectly renders alt
>attribute:
>alt="<%=Value %>"
>It seems like it is a problem at compile-time. I cannot use expressions in
>control attribute values.
>What could be wrong with this picture?
>Any hints highly appreciated.
>Tomasz J
>
>
Thank you Steven!
I was unaware of this limitation. This syntax worked with my ascx controls.
Good to know. Perhaps it is something which could be improved, because
binding is less convenient.
Tomasz J
"Steven Cheng[MSFT]" <stcheng@.online.microsoft.com> wrote in message
news:spXdCfpUIHA.4720@.TK2MSFTNGHUB02.phx.gbl...
> Hi Tomasz,
> As for the problem you met, it is due to the limitation of expression that
> can be used inside ASP.NET server control attribute/tag. The <%= %>
> expression is brought from classic ASP for compatible purpose and can only
> be used in plain html fragment(at top level of aspx page or ascx user
> control).
> For ASP.NET server control tag, you can consider the following means to
> embed dynamic value:
> 1. Use <%# ... %> like databinding expression, however, you need to call
> control.DataBind() at runtime (in page load or init ...) so as to make the
> databinding expression get evaluated.
> 2. In ASP.NET 2.0, there provides a custom Expression Builder
> functionality, that can help you define your own custom expression(can be
> used inside server control tag/attributes). Here are some articles
> introducing this:
> #The CodeExpressionBuilder
> http://weblogs.asp.net/infinitieslo...ve/2007/01.aspx
> Hope this helps.
> Sincerely,
> Steven Cheng
> Microsoft MSDN Online Support Lead
>
> ========================================
==========
> Get notification to my posts through email? Please refer to
> l]
> ications.
>
> Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
> where an initial response from the community or a Microsoft Support
> Engineer within 1 business day is acceptable. Please note that each follow
> up response may take approximately 2 business days as the support
> professional working with you may need further investigation to reach the
> most efficient resolution. The offering is not appropriate for situations
> that require urgent, real-time or phone-based interactions or complex
> project analysis and dump analysis issues. Issues of this nature are best
> handled working with a dedicated Microsoft Support Engineer by contacting
> Microsoft Customer Support Services (CSS) at
> [url]http://msdn.microsoft.com/subscriptions/support/default.aspx." target="_blank">http://msdn.microsoft.com/subscript...t/default.aspx.
> ========================================
==========
>
> This posting is provided "AS IS" with no warranties, and confers no
> rights.
>
> --
>
> Control
>
Thanks for your reply Tomasz,
Yes, I agree that Binding Expression is not quite convenient for value
assignment cases. I think that's why "code expression bulder" is added in
ASP.NET 2.0 which is quite flexible and powerful :)
Sincerely,
Steven Cheng
Microsoft MSDN Online Support Lead
This posting is provided "AS IS" with no warranties, and confers no rights.
--
>From: "Tomasz J" <oegweb@.nospam.nospam>
>References: <#an5P0lUIHA.4768@.TK2MSFTNGP02.phx.gbl>
<spXdCfpUIHA.4720@.TK2MSFTNGHUB02.phx.gbl>
>Subject: Re: Strange Custom Control Problem (.Net 2.0)
>Date: Wed, 9 Jan 2008 16:30:32 +0100
>Thank you Steven!
>I was unaware of this limitation. This syntax worked with my ascx controls.
>Good to know. Perhaps it is something which could be improved, because
>binding is less convenient.
>Tomasz J
>
>"Steven Cheng[MSFT]" <stcheng@.online.microsoft.com> wrote in message
>news:spXdCfpUIHA.4720@.TK2MSFTNGHUB02.phx.gbl...
that
only
the
http://weblogs.asp.net/infinitieslo...CodeExpressionB
http://msdn.microsoft.com/subscript...ault.aspx#notif
issues
follow
in
>
>
Monday, March 26, 2012
Strange Error
"An error has occurred because a control with auto-generated id '_ctl0' could not be located to raise a postback event. To avoid this error, explicitly set the ID property of controls that raise postback events. "
The page consists of a dynamically created table web control in codebehind - that's it.
Instead of posting code and seeing what's wrong with it (if anything), I'm just curious if anyone has ever had experience with this message. I googled and found very little, and the one guy who resolved his issue said "Ah, the error message had nothing to do with the real problem..." but doesn't explain what he did to correct it.I managed to find a way around my problem. Due to the architecture of this project, I have to avoid some of the things that make .NET easier for everyone - viewstate and querystrings. The page prior to this one submitted to it via Javascript, so when my page loaded, I would Request.Form() on any of the items that I needed.
Solution:
I ditched the Javascript part of it, by implementing ASP.NET's button web control, and redirected to the page using a querystring instead. Then on the Page_Load, I just retrieved the querystring values, and populated the necessary variables.
Saturday, March 24, 2012
strange error in asp.net application using Web user control
I made a webuser control which is a menu with some links. Now iam trying to add an asp drop downlist in the webuser control an it is giving me this error:
Control 'Menu1_DropDownList14' of type 'DropDownList' must be placed inside a form tag with runat=server.
I know that webuser control does not consists of the FORM tag so why is it giving me error:
Here is my code :
<%@dotnet.itags.org. Control Language="c#" AutoEventWireup="false" Codebehind="menu.ascx.cs" Inherits="Hospital.menu" TargetSchema="http://schemas.microsoft.com/intellisense/ie5"%
<DIV style="WIDTH: 170px; POSITION: relative; HEIGHT: 179px" ms_positioning="GridLayout"
<asp:HyperLink id="HyperLink1" style="Z-INDEX: 101; LEFT: 17px; POSITION: absolute; TOP: 11px" runat="server" ForeColor="ActiveCaptionText" NavigateUrl="testaspx.aspx" Font-Bold="True"
<span class="NormalBold">Add Patient</span></asp:HyperLink
<asp:HyperLink id="HyperLink2" style="Z-INDEX: 102; LEFT: 16px; POSITION: absolute; TOP: 94px" runat="server" ForeColor="ActiveCaption" NavigateUrl="AddVolunteer.aspx"
<span class="NormalBold">Add Volunteer</span></asp:HyperLink
<asp:HyperLink id="HyperLink3" style="Z-INDEX: 103; LEFT: 9px; POSITION: absolute; TOP: 129px" ForeColor="ActiveCaption" runat="server" NavigateUrl="VolunteerList.aspx"
<span class="NormalBold">List of Volunteers</span></asp:HyperLink
<asp:DropDownList id="DropDownList14" style="Z-INDEX: 104; LEFT: 24px; POSITION: absolute; TOP: 51px" Runat =server ></asp:DropDownList></DIV
------------------------You need to place the UserControl inside a form tag with RunAt=Server.
You need to place your User Control (ASCX) inside an ASPX page and, as Douglas points out, that ASPX page must wrap your user control inside <form runat="server"> ... </form> tags.
Like this:
<%@. Page Language="VB" Debug="true" %>
<%@. Register TagPrefix="my" TagName="UserControl" src="http://pics.10026.com/?src=mycontrol.ascx" %>
<html>
<head>
</head>
<body>
<form runat="server">
<my:UserControl id="myUserControl" runat="server"></my:UserControl>
</form>
</body>
</html>
Thanks a lot
Strange error message at client
I would like to do database change on a web page created with ASP.NET.
As soon as I click on Update in a datagrid web control, I get following
error message:
Unable to find script library
'/asp_client/system_web/1_0_3705_288/WebUIValidation.js'. Try placing this
file manually, or reinstall by running 'aspnet_regiis -c'.
I must say, that this file does exist in the path shown in the error
message. Insofar the error message is very strange.
Which are the reasons for the error? Could it be, that some ASP.NET sites
use a SmartNavigation or are the security settings at client to high?
Regards,
RobertTry running aspnet_regiis on the web site you are using. This is a
client-side error that is triggered by the file not being there, at least
from the client's perspective, so that's a good place to start.
--
Chris Jackson
Software Engineer
Microsoft MVP - Windows Shell/UI
Windows XP Associate Expert
--
More people read the newsgroups than read my email.
Reply to the newsgroup for a faster response.
(Control-G using Outlook Express)
--
"Robert Wehofer" <thalion77@.graffiti.net> wrote in message
news:c4%tb.112229$W7.62099@.news.chello.at...
> Hello!
> I would like to do database change on a web page created with ASP.NET.
> As soon as I click on Update in a datagrid web control, I get following
> error message:
> Unable to find script library
> '/asp_client/system_web/1_0_3705_288/WebUIValidation.js'. Try placing this
> file manually, or reinstall by running 'aspnet_regiis -c'.
> I must say, that this file does exist in the path shown in the error
> message. Insofar the error message is very strange.
> Which are the reasons for the error? Could it be, that some ASP.NET sites
> use a SmartNavigation or are the security settings at client to high?
> Regards,
> Robert
strange event postback behaviour in dynamically created usercontrol
i have an aspx page which dynamically loads a user control and adds it
to a placeholder. the control is recreated and added to the
placeholder for postbacks as well.
the user control contains a datagrid and some buttons and textboxes.
the button events fire correctly and execute their code. however, the
datagrid events fire a postback, and execute Page_load in the
usercontrol, but the Item_Command code is not executed. the code to
add events to the datagrid is in InitialiseComponent.
i have the datagrid binding in UserControl_PreRender, so that it is
bound between postbacks.
can anyone suggest why the postback is happening without the
ItemCommand event happening? i've verified this with VS debugging.
thanks
timHi Tim_Mac,
Welcome to ASP.NET newsgroup.
From your description, you've a UserControl which contains some button and
a DataGrid on it, the datagrid is subscribing some postback
events(ItemCommand). And in one of your asp.net page, you dynamically load
the usercontrol and add it on your page. However, you found the ItemCommand
of the datagrid(in usercontrol) always not fire, yes?
Based on my experience, such event handler not executing problem is likely
caused by the following things:
1. For dynamic loaded(created) controls, make sure we add them in the
Page_Init or Page_Load every time the page is requested(IsPostback or
not...).
2. For control's event handler, we also need to register them in Init or
Load event. Also, for template databound controls such as DataGrid or
DataList, we should avoid rebinding them with different datasource before
processing postback event since the event may depend on the original binded
datas.
As for your condition, since some other controls (such as button)'s event
handler execute correctly. I think the problem is likely within the
UserControl itself. Would you try registering your datagrid's ItemCommand
handler in the usercontrol's ascx template instead of programmatically
register in codebehind? Just like
<asp:datagrid ..... OnItemCommand="DataGrid_ItemCommand" ...
If you feel it convenient, I suggest you try build a simpler usercontrol
(contains a datagrid) so as to repro the problem and send it to me. Then I
can do some researchs on my side.
In addition, if you feel necessary, I can also generate a test page on my
side and let you have a compare to see whehter there are any difference.
Please feel free to let me know if you have any questions. Thanks,
Steven Cheng
Microsoft Online Support
Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
hi Steven,
thank you for your most helpful reply.
i have got it working now, and will attempt to explain how and why for
future reference.
my aspx page contaings the following in Page_Load:
Modules.SportsLadder ladder =
this.LoadControl("Modules/SportsLadder.ascx") as Modules.SportsLadder;
this.serverForm.Controls.Add(ladder);
the user control is loaded regardless of whether a postback has taken
place or not.
the user control then contains a call to if(!IsPostBack) BindGrid() in
the Page_Load.
when i would delete an item in the datagrid, the page would post back,
and Page_Load would fire, but the datagrid_itemcommand event would not
fire. the datagrid would disappear from the page.
i tried adding in a PreRender event for the usercontrol, and calling
BindGrid() there, and that kept the datagrid on screen after postbacks,
but the itemcommand event still didn't fire. what got it working was i
removed the if(!IsPostBack) from the Page_Load of the user control, so
then the datagrid is bound every time. i then had the problem of the
itemcommand event being called twice (what a surprise). the reason is
because it was set in the aspx page, as Steven suggested:
<asp:datagrid ..... OnItemCommand="DataGrid_ItemCommand" ...>
but it was also set in InitialiseComponent in code. i took it out of
the code, and let the aspx handler do it.
now it works perfectly. i didn't run into any problems re-binding the
datagrid in Page_Load, my methods were still able to identify the row
that was clicked and any of the controls in the cells.
thanks for your help.
tim
strange event postback behaviour in dynamically created usercontrol
i have an aspx page which dynamically loads a user control and adds it
to a placeholder. the control is recreated and added to the
placeholder for postbacks as well.
the user control contains a datagrid and some buttons and textboxes.
the button events fire correctly and execute their code. however, the
datagrid events fire a postback, and execute Page_load in the
usercontrol, but the Item_Command code is not executed. the code to
add events to the datagrid is in InitialiseComponent.
i have the datagrid binding in UserControl_PreRender, so that it is
bound between postbacks.
can anyone suggest why the postback is happening without the
ItemCommand event happening? i've verified this with VS debugging.
thanks
timHi Tim_Mac,
Welcome to ASP.NET newsgroup.
From your description, you've a UserControl which contains some button and
a DataGrid on it, the datagrid is subscribing some postback
events(ItemCommand). And in one of your asp.net page, you dynamically load
the usercontrol and add it on your page. However, you found the ItemCommand
of the datagrid(in usercontrol) always not fire, yes?
Based on my experience, such event handler not executing problem is likely
caused by the following things:
1. For dynamic loaded(created) controls, make sure we add them in the
Page_Init or Page_Load every time the page is requested(IsPostback or
not...).
2. For control's event handler, we also need to register them in Init or
Load event. Also, for template databound controls such as DataGrid or
DataList, we should avoid rebinding them with different datasource before
processing postback event since the event may depend on the original binded
datas.
As for your condition, since some other controls (such as button)'s event
handler execute correctly. I think the problem is likely within the
UserControl itself. Would you try registering your datagrid's ItemCommand
handler in the usercontrol's ascx template instead of programmatically
register in codebehind? Just like
<asp:datagrid ..... OnItemCommand="DataGrid_ItemCommand" ...>
If you feel it convenient, I suggest you try build a simpler usercontrol
(contains a datagrid) so as to repro the problem and send it to me. Then I
can do some researchs on my side.
In addition, if you feel necessary, I can also generate a test page on my
side and let you have a compare to see whehter there are any difference.
Please feel free to let me know if you have any questions. Thanks,
Steven Cheng
Microsoft Online Support
Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
hi Steven,
thank you for your most helpful reply.
i have got it working now, and will attempt to explain how and why for
future reference.
my aspx page contaings the following in Page_Load:
Modules.SportsLadder ladder =
this.LoadControl("Modules/SportsLadder.ascx") as Modules.SportsLadder;
this.serverForm.Controls.Add(ladder);
the user control is loaded regardless of whether a postback has taken
place or not.
the user control then contains a call to if(!IsPostBack) BindGrid() in
the Page_Load.
when i would delete an item in the datagrid, the page would post back,
and Page_Load would fire, but the datagrid_itemcommand event would not
fire. the datagrid would disappear from the page.
i tried adding in a PreRender event for the usercontrol, and calling
BindGrid() there, and that kept the datagrid on screen after postbacks,
but the itemcommand event still didn't fire. what got it working was i
removed the if(!IsPostBack) from the Page_Load of the user control, so
then the datagrid is bound every time. i then had the problem of the
itemcommand event being called twice (what a surprise). the reason is
because it was set in the aspx page, as Steven suggested:
<asp:datagrid ..... OnItemCommand="DataGrid_ItemCommand" ...>
but it was also set in InitialiseComponent in code. i took it out of
the code, and let the aspx handler do it.
now it works perfectly. i didn't run into any problems re-binding the
datagrid in Page_Load, my methods were still able to identify the row
that was clicked and any of the controls in the cells.
thanks for your help.
tim
Hi Tim_Mac,
Thanks a lot for your detailed response. I'm glat that you've got greate
progress on this issue. Though you've got it worked currently, I'm still
abit confusing about your detailed page and usercontrol's code logic. Based
on my understanding, as long as your UserControl is added into the page's
control collection everytime( and has a fixed it assigned to it). We don't
need to bind data to the datagrid(in the usercontrol) everytime, just in
If(! IsPostback) ) or in a postback event is ok. And the ItemCommand can
also fire correctly.
I've attached a sample page/usercontrol I used to test. You can have a test
on your side if you have interesting.
Hope helps. If there is anything else unclear, please feel free to post
here. Thanks,
Steven Cheng
Microsoft Online Support
Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
Thursday, March 22, 2012
Strange firing sequence??
I am using custom control COCA that includes an Image IMAGO. IMAGO raises
the Click event for COCA when clicked. All good so far.
The custom control COCA is created dynamically and lives on a Webform1.
Whenever COCA is clicked, the COCA_Clicked event on Webform1 needs to fire
and return the coordinates values of COCA to a textbox on the form (done via
VB: AddHandler CC1.Click, AddressOf CC1_Clicked).
Here's the confusing part: when CC1 is clicked on the form the first thing
that happens is the page posts back. Only then, CC1_Clicked fires, and
writes value to the textbox. I see CC1_Clicked running by settping through
and the values ARE being written to the textbox but they never actually show
up on the form because they are written after the postback. A second click
causes a postback, writes out the previous values, runs CC1_Clicked... so
the output on the form is always 1 phase behind.
Scratching my head... shouldn't this be the other way around?
Click >> CC1_Clicked fires >> writes values to textbox >> page postback?
The custom control:
- Implements INamingContainer
- adds the ImageButton control in CreateChildControls()
- Overrides the Render method and uses EnsureChildControls()
- Is added to the webform with: Me.FindControl("form1").Controls.Add(CC1)
Any ideas? Suggestions? Corrections?
Thanks. Assaf.Sorry folks: spellchecker out of control.
COCA = CC1
IMAGO = IMG1
"Assaf" <at@.isp.com> wrote in message
news:%23jh5xwwPEHA.648@.TK2MSFTNGP10.phx.gbl...
> Hi all. Can't explain this...
> I am using custom control COCA that includes an Image IMAGO. IMAGO raises
> the Click event for COCA when clicked. All good so far.
> The custom control COCA is created dynamically and lives on a Webform1.
> Whenever COCA is clicked, the COCA_Clicked event on Webform1 needs to fire
> and return the coordinates values of COCA to a textbox on the form (done
via
> VB: AddHandler CC1.Click, AddressOf CC1_Clicked).
> Here's the confusing part: when CC1 is clicked on the form the first thing
> that happens is the page posts back. Only then, CC1_Clicked fires, and
> writes value to the textbox. I see CC1_Clicked running by settping through
> and the values ARE being written to the textbox but they never actually
show
> up on the form because they are written after the postback. A second click
> causes a postback, writes out the previous values, runs CC1_Clicked... so
> the output on the form is always 1 phase behind.
> Scratching my head... shouldn't this be the other way around?
> Click >> CC1_Clicked fires >> writes values to textbox >> page postback?
> The custom control:
> - Implements INamingContainer
> - adds the ImageButton control in CreateChildControls()
> - Overrides the Render method and uses EnsureChildControls()
> - Is added to the webform with: Me.FindControl("form1").Controls.Add(CC1)
> Any ideas? Suggestions? Corrections?
> Thanks. Assaf.
>
Strange firing sequence??
I am using custom control COCA that includes an Image IMAGO. IMAGO raises
the Click event for COCA when clicked. All good so far.
The custom control COCA is created dynamically and lives on a Webform1.
Whenever COCA is clicked, the COCA_Clicked event on Webform1 needs to fire
and return the coordinates values of COCA to a textbox on the form (done via
VB: AddHandler CC1.Click, AddressOf CC1_Clicked).
Here's the confusing part: when CC1 is clicked on the form the first thing
that happens is the page posts back. Only then, CC1_Clicked fires, and
writes value to the textbox. I see CC1_Clicked running by settping through
and the values ARE being written to the textbox but they never actually show
up on the form because they are written after the postback. A second click
causes a postback, writes out the previous values, runs CC1_Clicked... so
the output on the form is always 1 phase behind.
Scratching my head... shouldn't this be the other way around?
Click >> CC1_Clicked fires >> writes values to textbox >> page postback?
The custom control:
- Implements INamingContainer
- adds the ImageButton control in CreateChildControls()
- Overrides the Render method and uses EnsureChildControls()
- Is added to the webform with: Me.FindControl("form1").Controls.Add(CC1)
Any ideas? Suggestions? Corrections?
Thanks. Assaf.Sorry folks: spellchecker out of control.
COCA = CC1
IMAGO = IMG1
"Assaf" <at@.isp.com> wrote in message
news:%23jh5xwwPEHA.648@.TK2MSFTNGP10.phx.gbl...
> Hi all. Can't explain this...
> I am using custom control COCA that includes an Image IMAGO. IMAGO raises
> the Click event for COCA when clicked. All good so far.
> The custom control COCA is created dynamically and lives on a Webform1.
> Whenever COCA is clicked, the COCA_Clicked event on Webform1 needs to fire
> and return the coordinates values of COCA to a textbox on the form (done
via
> VB: AddHandler CC1.Click, AddressOf CC1_Clicked).
> Here's the confusing part: when CC1 is clicked on the form the first thing
> that happens is the page posts back. Only then, CC1_Clicked fires, and
> writes value to the textbox. I see CC1_Clicked running by settping through
> and the values ARE being written to the textbox but they never actually
show
> up on the form because they are written after the postback. A second click
> causes a postback, writes out the previous values, runs CC1_Clicked... so
> the output on the form is always 1 phase behind.
> Scratching my head... shouldn't this be the other way around?
> Click >> CC1_Clicked fires >> writes values to textbox >> page postback?
> The custom control:
> - Implements INamingContainer
> - adds the ImageButton control in CreateChildControls()
> - Overrides the Render method and uses EnsureChildControls()
> - Is added to the webform with: Me.FindControl("form1").Controls.Add(CC1)
> Any ideas? Suggestions? Corrections?
> Thanks. Assaf.
strange file upload behaviour (404 with one pdf but not with another)
Maybe there is an oracle out there who can help.
I have an aspx site and a simple fileupload control on it.
Everything works fine except:
I can reproduce an 404 error when trying to upload some files.
It only happens when trying to upload PDF Files, and not on every PDF
File.
Let me illustrate this
xy.pdf - upload no problem
ab.pdf - 404 - Cannot find server or DNS Error
There are more pdf's where the problem occurs and also some others
where it does not..
The error comes within a millisecond as if IE does not try to upload.
What the heck is this...?i bet you the one that doesn't work is over 4 megs right?
mikecom@.gmx.net wrote:
> Hi
> Maybe there is an oracle out there who can help.
> I have an aspx site and a simple fileupload control on it.
> Everything works fine except:
> I can reproduce an 404 error when trying to upload some files.
> It only happens when trying to upload PDF Files, and not on every PDF
> File.
> Let me illustrate this
> xy.pdf - upload no problem
> ab.pdf - 404 - Cannot find server or DNS Error
> There are more pdf's where the problem occurs and also some others
> where it does not..
> The error comes within a millisecond as if IE does not try to upload.
> What the heck is this...?
max upload size in asp.net is 4 MB
you can change this in web.config:
<httpRuntime maxRequestLength="size in kbytes" /
asp.net uploads files into memory, so a 1 GB upload will take 1 GB of
memory on your server. if you want to upload big files, you'll need to
buy an upload component that streams uploaded files to disk.
mikecom@.gmx.net wrote:
> Hi
> Maybe there is an oracle out there who can help.
> I have an aspx site and a simple fileupload control on it.
> Everything works fine except:
> I can reproduce an 404 error when trying to upload some files.
> It only happens when trying to upload PDF Files, and not on every PDF
> File.
> Let me illustrate this
> xy.pdf - upload no problem
> ab.pdf - 404 - Cannot find server or DNS Error
> There are more pdf's where the problem occurs and also some others
> where it does not..
> The error comes within a millisecond as if IE does not try to upload.
> What the heck is this...?
Bet won!
That was the problem...
Tanks a lot!
neilmcguigan@.gmail.com wrote:
> max upload size in asp.net is 4 MB
> you can change this in web.config:
> <httpRuntime maxRequestLength="size in kbytes" />
> asp.net uploads files into memory, so a 1 GB upload will take 1 GB of
> memory on your server. if you want to upload big files, you'll need to
> buy an upload component that streams uploaded files to disk.
> mikecom@.gmx.net wrote:
> > Hi
> > Maybe there is an oracle out there who can help.
> > I have an aspx site and a simple fileupload control on it.
> > Everything works fine except:
> > I can reproduce an 404 error when trying to upload some files.
> > It only happens when trying to upload PDF Files, and not on every PDF
> > File.
> > Let me illustrate this
> > xy.pdf - upload no problem
> > ab.pdf - 404 - Cannot find server or DNS Error
> > There are more pdf's where the problem occurs and also some others
> > where it does not..
> > The error comes within a millisecond as if IE does not try to upload.
> > What the heck is this...?
strange file upload behaviour (404 with one pdf but not with another)
Maybe there is an oracle out there who can help.
I have an aspx site and a simple fileupload control on it.
Everything works fine except:
I can reproduce an 404 error when trying to upload some files.
It only happens when trying to upload PDF Files, and not on every PDF
File.
Let me illustrate this
xy.pdf - upload no problem
ab.pdf - 404 - Cannot find server or DNS Error
There are more pdf's where the problem occurs and also some others
where it does not..
The error comes within a millisecond as if IE does not try to upload.
What the heck is this...?i bet you the one that doesn't work is over 4 megs right?
mikecom@.gmx.net wrote:
> Hi
> Maybe there is an oracle out there who can help.
> I have an aspx site and a simple fileupload control on it.
> Everything works fine except:
> I can reproduce an 404 error when trying to upload some files.
> It only happens when trying to upload PDF Files, and not on every PDF
> File.
> Let me illustrate this
> xy.pdf - upload no problem
> ab.pdf - 404 - Cannot find server or DNS Error
> There are more pdf's where the problem occurs and also some others
> where it does not..
> The error comes within a millisecond as if IE does not try to upload.
> What the heck is this...?
max upload size in asp.net is 4 MB
you can change this in web.config:
<httpRuntime maxRequestLength="size in kbytes" />
asp.net uploads files into memory, so a 1 GB upload will take 1 GB of
memory on your server. if you want to upload big files, you'll need to
buy an upload component that streams uploaded files to disk.
mikecom@.gmx.net wrote:
> Hi
> Maybe there is an oracle out there who can help.
> I have an aspx site and a simple fileupload control on it.
> Everything works fine except:
> I can reproduce an 404 error when trying to upload some files.
> It only happens when trying to upload PDF Files, and not on every PDF
> File.
> Let me illustrate this
> xy.pdf - upload no problem
> ab.pdf - 404 - Cannot find server or DNS Error
> There are more pdf's where the problem occurs and also some others
> where it does not..
> The error comes within a millisecond as if IE does not try to upload.
> What the heck is this...?
Bet won!
That was the problem...
Tanks a lot!
neilmcguigan@.gmail.com wrote:
> max upload size in asp.net is 4 MB
> you can change this in web.config:
> <httpRuntime maxRequestLength="size in kbytes" />
> asp.net uploads files into memory, so a 1 GB upload will take 1 GB of
> memory on your server. if you want to upload big files, you'll need to
> buy an upload component that streams uploaded files to disk.
> mikecom@.gmx.net wrote:
Strange Issue on replacing Image control with ImageButton control
I'm using a DataGrid with a template column to display an Image inside
of it. I'm hooking into its OnPrerender-Event to set the
ImageURL-Property dynamically.
Everything works just fine here, until I thought "It would be cool, if
the user could click on that image..". So I replaced the Image-Control
with an ImageButton.
My Problem is, that the ImageButton doesn't fire any events. Any other
control works just fine but I'm having no luck getting the ImageButton
to work.
I'm happy about any ideas..
Regards
Jens
---------------
Code-Snippet
------
aspx-Page
<asp:TemplateColumn HeaderText="Images">
<ItemTemplate>
<asp:Image id="imgPic" runat="server"
OnPreRender="imgPic_PreRender"></asp:Image>
<asp:ImageButton id="ibtnPic" runat="server"
OnPreRender="ibtnPic_PreRender"></asp:ImageButton>
</ItemTemplate>
</asp:TemplateColumn
------
CodeBehind
protected void imgPic_PreRender(object sender, System.EventArgs e)
{
//this works as expected
Image img = sender as Image;
if (img == null)
{
return;
}
img.ImageURL = "dynamically-assigned.jpg";
}
protected void ibtnPic_PreRender(object sender, System.EventArgs e)
{
//this does not work
//
//if I rename this Method for testing purposes, the Page can't
//be loaded, as it doesn't find this Method
//
//if I set a Break-Point to first method, the program does not
//stop
ImageButton ibtn = sender as ImageButton;
if (ibtn == null)
{
return;
}
ibtn.ImageURL = "dynamically-assigned.jpg";
}Jens,
With thwe ImageButton you can setup both the Click and Command events. Do
you setup one of them?
Eliyahu
<jens.buchta@.gmx.net> wrote in message
news:1125557636.729770.63420@.g49g2000cwa.googlegro ups.com...
> Hi!
> I'm using a DataGrid with a template column to display an Image inside
> of it. I'm hooking into its OnPrerender-Event to set the
> ImageURL-Property dynamically.
> Everything works just fine here, until I thought "It would be cool, if
> the user could click on that image..". So I replaced the Image-Control
> with an ImageButton.
> My Problem is, that the ImageButton doesn't fire any events. Any other
> control works just fine but I'm having no luck getting the ImageButton
> to work.
> I'm happy about any ideas..
> Regards
> Jens
>
> ---------------
> Code-Snippet
> ------
> aspx-Page
> <asp:TemplateColumn HeaderText="Images">
> <ItemTemplate>
> <asp:Image id="imgPic" runat="server"
> OnPreRender="imgPic_PreRender"></asp:Image>
> <asp:ImageButton id="ibtnPic" runat="server"
> OnPreRender="ibtnPic_PreRender"></asp:ImageButton>
> </ItemTemplate>
> </asp:TemplateColumn>
> ------
> CodeBehind
> protected void imgPic_PreRender(object sender, System.EventArgs e)
> {
> //this works as expected
> Image img = sender as Image;
> if (img == null)
> {
> return;
> }
> img.ImageURL = "dynamically-assigned.jpg";
> }
> protected void ibtnPic_PreRender(object sender, System.EventArgs e)
> {
> //this does not work
> //
> //if I rename this Method for testing purposes, the Page can't
> //be loaded, as it doesn't find this Method
> //
> //if I set a Break-Point to first method, the program does not
> //stop
> ImageButton ibtn = sender as ImageButton;
> if (ibtn == null)
> {
> return;
> }
> ibtn.ImageURL = "dynamically-assigned.jpg";
> }
Thanks for your Answer!
I can set up the Click event to parse the CommandName and
CommandArgument. This is a way to react on the users PostBack, no
problem here.
The problem is, that i need the PreRender event to handle the ImageURL
before the ImageButton is drawn. At the moment, I can't catch this
event in the same way, as it works for the Image-control, so that the
image, the ImageButtons renders, is "none".
Jens
Why can't you handle the ImageUrl in Click event?
Eliyahu
<jens.buchta@.gmx.net> wrote in message
news:1125566088.815538.95660@.o13g2000cwo.googlegro ups.com...
> Thanks for your Answer!
> I can set up the Click event to parse the CommandName and
> CommandArgument. This is a way to react on the users PostBack, no
> problem here.
> The problem is, that i need the PreRender event to handle the ImageURL
> before the ImageButton is drawn. At the moment, I can't catch this
> event in the same way, as it works for the Image-control, so that the
> image, the ImageButtons renders, is "none".
> Jens
Strange Issue egarding ASP:textbox control.
display information to the user. If the user changes a value and clicks
save. I save the information to the database.
This sounds all well and good however the record does not get updated, in
fact I have traced it to the fact that the textbox.text property is not
being updated after the user changes the value.
Please, if you have experienced anything like this, please help. This is
very frustrating.That's not much information to go on but I suggest looking for something in
your onload that is rebinding or reloading the textbox with the original
data before you get to the click event of your save button. Remember that
onload is called before the button event.
Also, make sure you're only setting the value of the textbox from the
database when IsPostBack is false. If you're setting it in every case, you
will reset it before you get to the click event.
Good luck,
Dale
"Red" <wreyes@.optonline.net> wrote in message
news:OTvW$ONUEHA.2408@.tk2msftngp13.phx.gbl...
> I have a form. I fill the text property of all the textboxes on the form
to
> display information to the user. If the user changes a value and clicks
> save. I save the information to the database.
> This sounds all well and good however the record does not get updated, in
> fact I have traced it to the fact that the textbox.text property is not
> being updated after the user changes the value.
> Please, if you have experienced anything like this, please help. This is
> very frustrating.
>
Hey thanks alot. I can not beleive I made such a simple mistake. For days I
have been looking at everything accept for when I was displaying the data.
Anyway, thanks again.
"DalePres" <don-t-spa-m-me@.lea-ve-me-a-lone--.com> wrote in message
news:e05xBXNUEHA.2564@.TK2MSFTNGP11.phx.gbl...
> That's not much information to go on but I suggest looking for something
in
> your onload that is rebinding or reloading the textbox with the original
> data before you get to the click event of your save button. Remember that
> onload is called before the button event.
> Also, make sure you're only setting the value of the textbox from the
> database when IsPostBack is false. If you're setting it in every case,
you
> will reset it before you get to the click event.
> Good luck,
> Dale
> "Red" <wreyes@.optonline.net> wrote in message
> news:OTvW$ONUEHA.2408@.tk2msftngp13.phx.gbl...
> to
in
>
Strange Issue egarding ASP:textbox control.
display information to the user. If the user changes a value and clicks
save. I save the information to the database.
This sounds all well and good however the record does not get updated, in
fact I have traced it to the fact that the textbox.text property is not
being updated after the user changes the value.
Please, if you have experienced anything like this, please help. This is
very frustrating.That's not much information to go on but I suggest looking for something in
your onload that is rebinding or reloading the textbox with the original
data before you get to the click event of your save button. Remember that
onload is called before the button event.
Also, make sure you're only setting the value of the textbox from the
database when IsPostBack is false. If you're setting it in every case, you
will reset it before you get to the click event.
Good luck,
Dale
"Red" <wreyes@.optonline.net> wrote in message
news:OTvW$ONUEHA.2408@.tk2msftngp13.phx.gbl...
> I have a form. I fill the text property of all the textboxes on the form
to
> display information to the user. If the user changes a value and clicks
> save. I save the information to the database.
> This sounds all well and good however the record does not get updated, in
> fact I have traced it to the fact that the textbox.text property is not
> being updated after the user changes the value.
> Please, if you have experienced anything like this, please help. This is
> very frustrating.
Hey thanks alot. I can not beleive I made such a simple mistake. For days I
have been looking at everything accept for when I was displaying the data.
Anyway, thanks again.
"DalePres" <don-t-spa-m-me@.lea-ve-me-a-lone--.com> wrote in message
news:e05xBXNUEHA.2564@.TK2MSFTNGP11.phx.gbl...
> That's not much information to go on but I suggest looking for something
in
> your onload that is rebinding or reloading the textbox with the original
> data before you get to the click event of your save button. Remember that
> onload is called before the button event.
> Also, make sure you're only setting the value of the textbox from the
> database when IsPostBack is false. If you're setting it in every case,
you
> will reset it before you get to the click event.
> Good luck,
> Dale
> "Red" <wreyes@.optonline.net> wrote in message
> news:OTvW$ONUEHA.2408@.tk2msftngp13.phx.gbl...
> > I have a form. I fill the text property of all the textboxes on the form
> to
> > display information to the user. If the user changes a value and clicks
> > save. I save the information to the database.
> > This sounds all well and good however the record does not get updated,
in
> > fact I have traced it to the fact that the textbox.text property is not
> > being updated after the user changes the value.
> > Please, if you have experienced anything like this, please help. This is
> > very frustrating.
Strange Issue on replacing Image control with ImageButton control
I'm using a DataGrid with a template column to display an Image inside
of it. I'm hooking into its OnPrerender-Event to set the
ImageURL-Property dynamically.
Everything works just fine here, until I thought "It would be
the user could click on that image..". So I replaced the Image-Control
with an ImageButton.
My Problem is, that the ImageButton doesn't fire any events. Any other
control works just fine but I'm having no luck getting the ImageButton
to work.
I'm happy about any ideas..
Regards
Jens
---
Code-Snippet
aspx-Page
<asp:TemplateColumn HeaderText="Images">
<ItemTemplate>
<asp:Image id="imgPic" runat="server"
OnPreRender="imgPic_PreRender"></asp:Image>
<asp:ImageButton id="ibtnPic" runat="server"
OnPreRender="ibtnPic_PreRender"></asp:ImageButton>
</ItemTemplate>
</asp:TemplateColumn>
CodeBehind
protected void imgPic_PreRender(object sender, System.EventArgs e)
{
//this works as expected
Image img = sender as Image;
if (img == null)
{
return;
}
img.ImageURL = "dynamically-assigned.jpg";
}
protected void ibtnPic_PreRender(object sender, System.EventArgs e)
{
//this does not work
//
//if I rename this Method for testing purposes, the Page can't
//be loaded, as it doesn't find this Method
//
//if I set a Break-Point to first method, the program does not
//stop
ImageButton ibtn = sender as ImageButton;
if (ibtn == null)
{
return;
}
ibtn.ImageURL = "dynamically-assigned.jpg";
}Jens,
With thwe ImageButton you can setup both the Click and Command events. Do
you setup one of them?
Eliyahu
<jens.buchta@.gmx.net> wrote in message
news:1125557636.729770.63420@.g49g2000cwa.googlegroups.com...
> Hi!
> I'm using a DataGrid with a template column to display an Image inside
> of it. I'm hooking into its OnPrerender-Event to set the
> ImageURL-Property dynamically.
> Everything works just fine here, until I thought "It would be
> the user could click on that image..". So I replaced the Image-Control
> with an ImageButton.
> My Problem is, that the ImageButton doesn't fire any events. Any other
> control works just fine but I'm having no luck getting the ImageButton
> to work.
> I'm happy about any ideas..
> Regards
> Jens
>
> ---
> Code-Snippet
> --
> aspx-Page
> <asp:TemplateColumn HeaderText="Images">
> <ItemTemplate>
> <asp:Image id="imgPic" runat="server"
> OnPreRender="imgPic_PreRender"></asp:Image>
> <asp:ImageButton id="ibtnPic" runat="server"
> OnPreRender="ibtnPic_PreRender"></asp:ImageButton>
> </ItemTemplate>
> </asp:TemplateColumn>
> --
> CodeBehind
> protected void imgPic_PreRender(object sender, System.EventArgs e)
> {
> //this works as expected
> Image img = sender as Image;
> if (img == null)
> {
> return;
> }
> img.ImageURL = "dynamically-assigned.jpg";
> }
> protected void ibtnPic_PreRender(object sender, System.EventArgs e)
> {
> //this does not work
> //
> //if I rename this Method for testing purposes, the Page can't
> //be loaded, as it doesn't find this Method
> //
> //if I set a Break-Point to first method, the program does not
> //stop
> ImageButton ibtn = sender as ImageButton;
> if (ibtn == null)
> {
> return;
> }
> ibtn.ImageURL = "dynamically-assigned.jpg";
> }
>
Thanks for your Answer!
I can set up the Click event to parse the CommandName and
CommandArgument. This is a way to react on the users PostBack, no
problem here.
The problem is, that i need the PreRender event to handle the ImageURL
before the ImageButton is drawn. At the moment, I can't catch this
event in the same way, as it works for the Image-control, so that the
image, the ImageButtons renders, is "none".
Jens
Why can't you handle the ImageUrl in Click event?
Eliyahu
<jens.buchta@.gmx.net> wrote in message
news:1125566088.815538.95660@.o13g2000cwo.googlegroups.com...
> Thanks for your Answer!
> I can set up the Click event to parse the CommandName and
> CommandArgument. This is a way to react on the users PostBack, no
> problem here.
> The problem is, that i need the PreRender event to handle the ImageURL
> before the ImageButton is drawn. At the moment, I can't catch this
> event in the same way, as it works for the Image-control, so that the
> image, the ImageButtons renders, is "none".
> Jens
>
Tuesday, March 13, 2012
Strange problem
The user can perform a search selecting a value in dropdown or inserting in textbox and click on search button.
My sub verify if dropdown control or textbox changed and build sql string.
But the strange think is that all run only when I use dropdown. If I insert value in textbox and not dropdown search don't work.
The code don't run. Why?
I have inserted OnTextChanged event in textbox html code and OnSelectedIndexChanged in dropdown html code but nothing to do!
HELP ME, PLEASE!You need to post your code so we can help you.
strange problem
Strange problem
the main code is the updateTable(), this function populates a Table web control with rows of data, the last cell being a button, this button is attached an attribute to identify the row. A click event is attached to this button. The click event of this button fires the updateTable() again, using the attached attribute as the argument (sort of like a file structure, and the button says, enter this directory so it passes the directory name of that row, and reloads the table with the dir/files of that directory.
Now here is the problem, if I have my initial set root directory and updateTable(root dir) in the page_load, the click event fires correctly, but of course the updateTable gets called twice (which works as the click event is after the first one), but when you try to drill down a second time, it fouls it up because the path gets reset to the begining, and the new path doesn't exist there.
What I am trying to do is this.
Page_Load()
If (!Page.PostBack)
updateTable(Default Path)
Then have my button click event do
updateTable(myButton.Attributes["newDir"].ToString();
But with out the updateTable event firing on Page_Load, the click event does not get handled.
Hopefully this makes sense, if need more info, let me know.I been playing around with this problem for a bit tonight. And I made some changes.
I made the button click event simple set Session["currentDir"] and changed the Page_Load to call updateTable(Session["currentDir"].ToString(); and in the !Page.PostBack clause, I have it setting Session["currentDir"] to the application parameter setting for "rootDir" I have.
Now everything works, but... You got to click twice on all the buttons and I can't seem to figure out how to avoid that. The problem appears to be the click event doesn't fire until after the page is reloaded so the first time it has the last directory set, and changes the session variable, but will only update the table when you click it yet again.
It's a timing issue. You have to consider the fact that events are called after Load and before PreRender. Thus, if you make changes to the data from an event, you need to rebind the controls that depend on this data after you've made the change. Otherwise, the change will only be visible on the next postback (hence the "double click").
By the way, it's not a very good idea to use Session in this context.
Does this help?
How do you rebind the control, you mean attach the button handler to it again?
I tried doing it so that button event called the updateTable() function, but that didn't work unless the event fired in the beginning of page load, so I changed it to a session variable see if that helped. It make the thing work, but didn't solve the problem as now I have to click twice.
No, WhateverControl.DataBind();
The structure of your page should more or less be:
Init: create controls if necessary.
Load: read datasources and bind controls if not ispostback
Events: update data sources according to the event and rebind relevant controls.