Saturday, March 31, 2012
Strange behavior of invisible controls
I'm updating multiple rows in the datagrid, using the routine described in
the article "Top Questions about the DataGrid Web Server Control":
http://msdn.microsoft.com/library/d...>
ercontrol.asp
To determine which rows had been changed, I'm using the RowChanged sub:
Protected Sub RowChanged(ByVal sender As Object, _
ByVal e As System.EventArgs)
'----
--
' Add ID's for changed rows
'----
--
Try
Dim dgi As DataGridItem = _
CType(CType(sender, Control).NamingContainer, DataGridItem)
Dim IDlabel As Label = CType(dgi.FindControl("lblOrder"), Label)
Dim ID As Integer = CType(IDlabel.Text, Integer)
If Not (IDlist.Contains(ID)) Then
IDlist.Add(ID)
End If
Catch ex As Exception
Me.lblError.Text = "Error No.: " & Err.Number.ToString & " - " & ex.ToString
End Try
End Sub
<asp:CheckBox id="chkInHouse" ToolTip="Plates In House" runat="server"
OnCheckedChanged="RowChanged" Checked='<%# DataBinder.Eval(Container,
"DataItem.InHouse") %>'>
It works OK everywhere, except one datagrid where some of my checkboxes are
invisible - the user has to click a button to make them visible. These
invisible checkboxes always indicate that their values had been changed. As
a result all my data from the datagrid is sent to the database, even if no
changes has been made. As soon as I make these checkboxes visible -
everything works OK.
Why is this happening? Is there any workaround?
I would appreciate your help.
Thank you,
Peter AfoninHi,
If you set checkbox visibility by visible property and you are using
postback to change visible state maybe there is something in the
postback activity that cause that behavior.
you can change check box visibility by changing visibility attribute of
control Style using javascrit thus reducing network traffic.
Natty Gur[MVP]
blog : http://weblogs.asp.net/ngur
Mobile: +972-(0)58-888377
*** Sent via Developersdex http://www.examnotes.net ***
Don't just participate in USENET...get rewarded for it!
Thank you, Natty.
Do you have a JavaScript sample on how to do this? I don't know JS well.
Peter
"Natty Gur" <natty@.dao2com.com> wrote in message
news:Occ$GsiPEHA.164@.TK2MSFTNGP12.phx.gbl...
> Hi,
> If you set checkbox visibility by visible property and you are using
> postback to change visible state maybe there is something in the
> postback activity that cause that behavior.
> you can change check box visibility by changing visibility attribute of
> control Style using javascrit thus reducing network traffic.
> Natty Gur[MVP]
> blog : http://weblogs.asp.net/ngur
> Mobile: +972-(0)58-888377
>
> *** Sent via Developersdex http://www.examnotes.net ***
> Don't just participate in USENET...get rewarded for it!
Strange behavior of invisible controls
I'm updating multiple rows in the datagrid, using the routine described in
the article "Top Questions about the DataGrid Web Server Control":
http://msdn.microsoft.com/library/d...ercontrol. asp
To determine which rows had been changed, I'm using the RowChanged sub:
Protected Sub RowChanged(ByVal sender As Object, _
ByVal e As System.EventArgs)
'-----------------------
-------
' Add ID's for changed rows
'-----------------------
-------
Try
Dim dgi As DataGridItem = _
CType(CType(sender, Control).NamingContainer, DataGridItem)
Dim IDlabel As Label = CType(dgi.FindControl("lblOrder"), Label)
Dim ID As Integer = CType(IDlabel.Text, Integer)
If Not (IDlist.Contains(ID)) Then
IDlist.Add(ID)
End If
Catch ex As Exception
Me.lblError.Text = "Error No.: " & Err.Number.ToString & " - " & ex.ToString
End Try
End Sub
<asp:CheckBox id="chkInHouse" ToolTip="Plates In House" runat="server"
OnCheckedChanged="RowChanged" Checked='<%# DataBinder.Eval(Container,
"DataItem.InHouse") %>'
It works OK everywhere, except one datagrid where some of my checkboxes are
invisible - the user has to click a button to make them visible. These
invisible checkboxes always indicate that their values had been changed. As
a result all my data from the datagrid is sent to the database, even if no
changes has been made. As soon as I make these checkboxes visible -
everything works OK.
Why is this happening? Is there any workaround?
I would appreciate your help.
Thank you,
--
Peter AfoninHi,
If you set checkbox visibility by visible property and you are using
postback to change visible state maybe there is something in the
postback activity that cause that behavior.
you can change check box visibility by changing visibility attribute of
control Style using javascrit thus reducing network traffic.
Natty Gur[MVP]
blog : http://weblogs.asp.net/ngur
Mobile: +972-(0)58-888377
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Thank you, Natty.
Do you have a JavaScript sample on how to do this? I don't know JS well.
Peter
"Natty Gur" <natty@.dao2com.com> wrote in message
news:Occ$GsiPEHA.164@.TK2MSFTNGP12.phx.gbl...
> Hi,
> If you set checkbox visibility by visible property and you are using
> postback to change visible state maybe there is something in the
> postback activity that cause that behavior.
> you can change check box visibility by changing visibility attribute of
> control Style using javascrit thus reducing network traffic.
> Natty Gur[MVP]
> blog : http://weblogs.asp.net/ngur
> Mobile: +972-(0)58-888377
>
> *** Sent via Developersdex http://www.developersdex.com ***
> Don't just participate in USENET...get rewarded for it!
Saturday, March 24, 2012
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
Tuesday, March 13, 2012
Strange problem
I've got a problem and I'm not getting much help trying to resolve it.
I've searched google all morning for an answer...
I have the following code:
Lab1.text = "Your Serial Number is: "
Lab2.text = serialNo & "-" & serialYY
Response.Clear()
Response.AddHeader("Content-Disposition", "attachment;
filename=" & fname)
Response.ContentType = "txt, doc, jpg"
Response.WriteFile(path)
which is supposed to output a serial number in two labels and then
download a file. The problem is that when I put the code to download
the file, the serial number is not displayed on the page.
To recap and make sure everything is clear. Without the download code
the labels get set correctly. When I put the download code in, the file
downloads correctly but the labels are never set.
Can someone explain what is going on??
Many thanks...It's a single response...you can't both stream normal html and biarny data
on it. It's a basic http/web thing. It's why if you go visit an image in
your browser, say, http://www.google.com/intl/en/images/logo.gif you'll
never see plain text as well as the image.
One solution might be to load the page, display your 2 labels, and use a
javascript to redirect to downloadSomeFile.aspx downloadSomeFile.aspx
would let the user download the file, while the page would stay where it is
since no new html stream was received.
Karl
--
http://www.openmymind.net/
http://www.codebetter.com/
"Flurry" <cj406168@.stmail.staffs.ac.ukwrote in message
news:1157715622.155464.218000@.m79g2000cwm.googlegr oups.com...
Quote:
Originally Posted by
Hello
>
I've got a problem and I'm not getting much help trying to resolve it.
I've searched google all morning for an answer...
>
I have the following code:
>
Lab1.text = "Your Serial Number is: "
Lab2.text = serialNo & "-" & serialYY
>
Response.Clear()
Response.AddHeader("Content-Disposition", "attachment;
filename=" & fname)
Response.ContentType = "txt, doc, jpg"
Response.WriteFile(path)
>
which is supposed to output a serial number in two labels and then
download a file. The problem is that when I put the code to download
the file, the serial number is not displayed on the page.
>
To recap and make sure everything is clear. Without the download code
the labels get set correctly. When I put the download code in, the file
downloads correctly but the labels are never set.
>
Can someone explain what is going on??
>
Many thanks...
>
Response.ContentType = "txt, doc, jpg"
ContentType should be a *MIME type*, like "text/plain",
"application/msword", "image/jpeg", not the file-extension.
See http://www.ltsw.se/knbase/internet/mime.htp
Hans Kesting