Showing posts with label aspx. Show all posts
Showing posts with label aspx. Show all posts

Saturday, March 31, 2012

Themes not working sometimes.

I am setting the src of a Iframe in the page load like this:
fraContent.Attributes.Item("src") = "Splash.aspx"
and sometimes the themes do not work. The page displays in the browser but
the themes are not applied. The <link ... is on the page when I look at the
soruce.
Any Ideas.
Thank you,
--
JerryHello Jerry,
I do not have your source code to test on directly. But here are some
suggestions that, I think, deserve your trial.
1. Does the "<link _" links to the correct theme page when the themes are
not applied? Please pay attention to the relative path. In my best guess,
the theme page cannot be loaded because the relative path to the page is
not correct.
2. Is the line fraContent.Attributes.Item("src") = "Splash.aspx" inside the
if statement: if (!Page.IsPostBack) { _ }?
If that, when the page post-back occurs, the line
fraContent.Attributes.Item("src") = "Splash.aspx" will not be executed in
the Page_Load event handler.
We can debug the site in Visual Studio, set a breakpoint on
fraContent.Attributes.Item("src") = "Splash.aspx" and see if it is executed
every time when we need to load the theme page.
3. When the theme page cannot be loaded, what is the browser? As far as I
know, some browsers do not support html tags very well.
By the way, since ASP.NET 2.0, a new feature "Theme & Skin" has been
supported by ASP.NET. If your theme pages only contain style information,
I'd suggest using ASP.NET Theme, which is much easier to accomplish the
task. For more information about "Theme and Skin" in ASP.NET, please refer
to:
ASP.NET Themes and Skins Overview
http://msdn2.microsoft.com/en-us/library/ykzx33wh.aspx
How to: Apply ASP.NET Themes Programmatically
http://www.15seconds.com/issue/040105.htm
Code in Style with ASP.NET Themes.
http://www.15seconds.com/issue/040105.htm
Hope it helps.
Regards,
Jialiang Ge (jialge@.online.microsoft.com, remove 'online.')
Microsoft Online Community Support
========================================
==========
For MSDN subscribers whose posts are left unanswered, please check this
document: http://blogs.msdn.com/msdnts/pages/postingAlias.aspx
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscript...ault.aspx#notif
ications. If you are using Outlook Express/Windows Mail, please make sure
you clear the check box "Tools/Options/Read: Get 300 headers at a time" to
see your reply promptly.
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.
Hello Jerry,
Sorry for the incorrect link to the article "How to: Apply ASP.NET Themes
Programmatically".
The link should be:
http://msdn2.microsoft.com/en-us/library/tx35bd89.aspx
If you have any other concerns or need anything else, please feel free to
let me know.
Regards,
Jialiang Ge (jialge@.online.microsoft.com, remove 'online.')
Microsoft Online Community Support
========================================
=========
When responding to posts, please "Reply to Group" via your newsreader
so that others may learn and benefit from your issue.
========================================
=========
This posting is provided "AS IS" with no warranties, and confers no rights.
Jialiang,
Thank you for your reply. The problem only occurs SOME of the time so all
the links are about appying the themes and if the code was not correct the
themes would not be there ALL of the time not just SOME of the times.
Anyway.
I have fixed the problem. This does not explain why the problem occured in
the first place. I placed a system.threading.thread.sleep line in the
LoadComplete event of the page. this seemed like the same problem solved by
the waitForEvents in window forms.
Have you seen any of this kind of problem.
Thank you
--
Jerry
"Jialiang Ge [MSFT]" wrote:

> Hello Jerry,
> Sorry for the incorrect link to the article "How to: Apply ASP.NET Themes
> Programmatically".
> The link should be:
> http://msdn2.microsoft.com/en-us/library/tx35bd89.aspx
> If you have any other concerns or need anything else, please feel free to
> let me know.
> Regards,
> Jialiang Ge (jialge@.online.microsoft.com, remove 'online.')
> Microsoft Online Community Support
> ========================================
=========
> When responding to posts, please "Reply to Group" via your newsreader
> so that others may learn and benefit from your issue.
> ========================================
=========
> This posting is provided "AS IS" with no warranties, and confers no rights
.
>

There can be only one page directive

I opened an asp page in VS.net 2002 and then saved it as an aspx page,
"mypage.aspx".

I was prompted if I wanted to create the class file for the page and clicked
yes.

Now when I try and open the page I get the error message :

"There can be only one 'page' directive."

I am sick of these problems. I have had a look in the folder and there is
only one "mypage.aspx.vb" file.

Whats happening ?A Page and a PageDirective are two different things. In your aspx page, make sure at the top their is one Page tag (directive).
Looks something like:
<@.Page ...>
and is at the top of the page.

There can be only one page directive

I opened an asp page in VS.net 2002 and then saved it as an aspx page,
"mypage.aspx".

I was prompted if I wanted to create the class file for the page and clicked
yes.

Now when I try and open the page I get the error message :

"There can be only one 'page' directive."

I am sick of these problems. I have had a look in the folder and there is
only one "mypage.aspx.vb" file.

Whats happening ?I haven't seen this error personally, but, in each .aspx file there can only
be one line that starts:

<%@. Page ... %
where you set things like the page language, caching directives etc. Perhaps
open the file in Notepad and check to see if you have more than one such
line.

Cheers
Ken

"Poppy" <paul.diamond@.NOSPAMthemedialounge.com> wrote in message
news:%23zo42FhnDHA.688@.TK2MSFTNGP10.phx.gbl...
: I opened an asp page in VS.net 2002 and then saved it as an aspx page,
: "mypage.aspx".
:
: I was prompted if I wanted to create the class file for the page and
clicked
: yes.
:
: Now when I try and open the page I get the error message :
:
: "There can be only one 'page' directive."
:
: I am sick of these problems. I have had a look in the folder and there is
: only one "mypage.aspx.vb" file.
:
: Whats happening ?
:
:

Monday, March 26, 2012

This is for the nth time I am posting. Is there no one to help!

I have a datalist control in my aspx page(this is
paginated and everytime submits to itself). I am calling a
function within my datalist that returns a html control
(radio button ) in the form of the string. I also have asp
server controls(labels) in the datalist. When the form is
processed, I am retrieving the values of the radio buttons
through Request.form. To retrieve the values of the asp
server controls , I am using FindControl method. But this
is written in the Page_Load method, so it returns the
values of the current page before the page gets submitted.
I want the values after the page gets submitted. How do I
retrieve them.
If I use onserverclick on my button (which is a html
control with rollover capability <a href>) , the onclick
doesn't work fine for validating the html controls. I
don't have runat=server on my form tag when I have onclick
attribute on the button. I am new to asp.net. I am not
able to use both onclick and onserverclick at the same
time. Why is it so..

Please help!!Maybe you could post some code. Its hard to tell what your problem is from
you message which you have posted several times.

"ani" <anonymous@.discussions.microsoft.com> wrote in message
news:01b601c3a3ce$cbdc78c0$a401280a@.phx.gbl...
> I have a datalist control in my aspx page(this is
> paginated and everytime submits to itself). I am calling a
> function within my datalist that returns a html control
> (radio button ) in the form of the string. I also have asp
> server controls(labels) in the datalist. When the form is
> processed, I am retrieving the values of the radio buttons
> through Request.form. To retrieve the values of the asp
> server controls , I am using FindControl method. But this
> is written in the Page_Load method, so it returns the
> values of the current page before the page gets submitted.
> I want the values after the page gets submitted. How do I
> retrieve them.
> If I use onserverclick on my button (which is a html
> control with rollover capability <a href>) , the onclick
> doesn't work fine for validating the html controls. I
> don't have runat=server on my form tag when I have onclick
> attribute on the button. I am new to asp.net. I am not
> able to use both onclick and onserverclick at the same
> time. Why is it so..
> Please help!!
sounds like you are not leveraging the page.postback property. page_load
gets called every time the page loads whether it is post back or not. the
onserverclicks will get loaded after page_load. sounds like you are loading
the datalist twice before doing a request.form on the data. you should only
build the datalist once. it will be in the viewstate on the postback, so no
need to reload it.

function page_load()
if page.ispostback then
'get checkbox values and labels or do nothing and rely on the
OnServerClick event
else
'load datalist
end if
end function

also if you want to use javascript onclick and asp.net's onserverclick do
this...
<input type="submit" id="btn" value="go" runat="server" onclick="return
validate();"
if you use <asp:button...>, the onclick event is looking for a public
function in the codebehind which default to private... not sure, but I have
to change that to public everytime.

again, without code samples, it is tough. I hope I helped a little bit.
~psb

"ani" <anonymous@.discussions.microsoft.com> wrote in message
news:01b601c3a3ce$cbdc78c0$a401280a@.phx.gbl...
> I have a datalist control in my aspx page(this is
> paginated and everytime submits to itself). I am calling a
> function within my datalist that returns a html control
> (radio button ) in the form of the string. I also have asp
> server controls(labels) in the datalist. When the form is
> processed, I am retrieving the values of the radio buttons
> through Request.form. To retrieve the values of the asp
> server controls , I am using FindControl method. But this
> is written in the Page_Load method, so it returns the
> values of the current page before the page gets submitted.
> I want the values after the page gets submitted. How do I
> retrieve them.
> If I use onserverclick on my button (which is a html
> control with rollover capability <a href>) , the onclick
> doesn't work fine for validating the html controls. I
> don't have runat=server on my form tag when I have onclick
> attribute on the button. I am new to asp.net. I am not
> able to use both onclick and onserverclick at the same
> time. Why is it so..
> Please help!!
This is how the presentation code look like. If I use
runat = server, ie; when I try to use onserverclick on the
button the javascript doesn't work . The displayanswers
method in the form returns a string of html text,basically
a table with radiobuttons or checkboxes aligned in it.

<form id="frmQuestion" method="post"
<ASP:DataList id="Questions" ShowHeader="false"
ShowFooter="false" runat="server" >
<ItemTemplate>
<TABLE ALIGN="left" >
<td
<asp:Label runat="server" Text='<%# DataBinder.Eval
(Container.DataItem, "MainQuestion_ID")%> '
ID="QuestionID" NAME="QuestionID">
</asp:Label
</td
<td
<asp:Label runat="server" Text='<%# DataBinder.Eval
(Container.DataItem, "MainQuestion_Txt")%>'
ID="QuestionTxt" NAME="QuestionTxt">
</asp:Label
</td
<td
<%# DisplayAnswers(DataBinder.Eval
(Container.DataItem, "MainQuestion_ID"),DataBinder.Eval
(Container.DataItem, "QuestionTypeID")) %
</td>
</tr></TABLE>
</ItemTemplate>
</ASP:DataList
<table align=right >
<tr><td
<a id=btnForward href="http://links.10026.com/?link=#"
onMouseOut="bforward.src='images/bforward.gif';"
onMouseOver="bforward.src='images/bforward_f2.gif';"
runat=server onclick="return validate();"><IMG
SRC="images/bforward.gif" ALT="" NAME="bforward"
ID="bforward" WIDTH="78" HEIGHT="24" BORDER="0"></A
</td></tr></table
I would like to retrieve the question id and the answer
(user-input) at the same time on click of the button. The
questionaire is paginated and this is the only form i am
using.

The code behind looks somewhat this way:

Sub Page_Load(ByVal Sender As Object, ByVal E As
EventArgs)

Dim oDt As DataTable
Dim oQuestion As Question ('This is the class
in my business layer)
oQuestion = New Question

Questions.DataSource = New DataView(oDt)
Questions.DataBind()

End Sub

What is the best way to handle Questionaire(online test)
projects . Can I display questions and answers at the same
time and how do I get questionid's and user-input to
insert into the database. There can be subquestions
This is how the presentation code look like. If I use
runat = server, ie; when I try to use onserverclick on the
button the javascript doesn't work . The displayanswers
method in the form returns a string of html text,basically
a table with radiobuttons or checkboxes aligned in it.

<form id="frmQuestion" method="post"
<ASP:DataList id="Questions" ShowHeader="false"
ShowFooter="false" runat="server" >
<ItemTemplate>
<TABLE ALIGN="left" >
<td
<asp:Label runat="server" Text='<%# DataBinder.Eval
(Container.DataItem, "MainQuestion_ID")%> '
ID="QuestionID" NAME="QuestionID">
</asp:Label
</td
<td
<asp:Label runat="server" Text='<%# DataBinder.Eval
(Container.DataItem, "MainQuestion_Txt")%>'
ID="QuestionTxt" NAME="QuestionTxt">
</asp:Label
</td
<td
<%# DisplayAnswers(DataBinder.Eval
(Container.DataItem, "MainQuestion_ID"),DataBinder.Eval
(Container.DataItem, "QuestionTypeID")) %
</td>
</tr></TABLE>
</ItemTemplate>
</ASP:DataList
<table align=right >
<tr><td
<a id=btnForward href="http://links.10026.com/?link=#"
onMouseOut="bforward.src='images/bforward.gif';"
onMouseOver="bforward.src='images/bforward_f2.gif';"
runat=server onclick="return validate();"><IMG
SRC="images/bforward.gif" ALT="" NAME="bforward"
ID="bforward" WIDTH="78" HEIGHT="24" BORDER="0"></A
</td></tr></table
I would like to retrieve the question id and the answer
(user-input) at the same time on click of the button. The
questionaire is paginated and this is the only form i am
using.

The code behind looks somewhat this way:

Sub Page_Load(ByVal Sender As Object, ByVal E As
EventArgs)

Dim oDt As DataTable
Dim oQuestion As Question ('This is the class
in my business layer)
oQuestion = New Question

Questions.DataSource = New DataView(oDt)
Questions.DataBind()

End Sub

What is the best way to handle Questionaire(online test)
projects . Can I display questions and answers at the same
time and how do I get questionid's and user-input to
insert into the database. There can be subquestions

Saturday, March 24, 2012

This should be easy, but...

I have a simple framed site with a Banner, Contents, & Main frames. The
contents page is an .aspx page that queries an MS Access database and dumps
its results into varios Dropdownlists and 1 Listbox. The users would select
from the list then click a button and the Table of Contents is updated
(works perfectly). The problem is that I can not get it to call a page to
the "main" frame. Redirect as I understand it will not redirect to a target
frame. Does anyone know the solution or work around. Keep in mind that it
is vital to refresh the TOC then call the "main" frame page.Thanks anyways, but I found the solution. Inserting javascript into vb
script.

"Mark Sandfox" <NoSpam@.NoSpam.com> wrote in message
news:09gKd.24076$by5.2210@.newssvr19.news.prodigy.c om...
>I have a simple framed site with a Banner, Contents, & Main frames. The
>contents page is an .aspx page that queries an MS Access database and dumps
>its results into varios Dropdownlists and 1 Listbox. The users would
>select from the list then click a button and the Table of Contents is
>updated (works perfectly). The problem is that I can not get it to call a
>page to the "main" frame. Redirect as I understand it will not redirect to
>a target frame. Does anyone know the solution or work around. Keep in
>mind that it is vital to refresh the TOC then call the "main" frame page.

This should be easy, but...

I have a simple framed site with a Banner, Contents, & Main frames. The
contents page is an .aspx page that queries an MS Access database and dumps
its results into varios Dropdownlists and 1 Listbox. The users would select
from the list then click a button and the Table of Contents is updated
(works perfectly). The problem is that I can not get it to call a page to
the "main" frame. Redirect as I understand it will not redirect to a target
frame. Does anyone know the solution or work around. Keep in mind that it
is vital to refresh the TOC then call the "main" frame page.Thanks anyways, but I found the solution. Inserting javascript into vb
script.
"Mark Sandfox" <NoSpam@.NoSpam.com> wrote in message
news:09gKd.24076$by5.2210@.newssvr19.news.prodigy.com...
>I have a simple framed site with a Banner, Contents, & Main frames. The
>contents page is an .aspx page that queries an MS Access database and dumps
>its results into varios Dropdownlists and 1 Listbox. The users would
>select from the list then click a button and the Table of Contents is
>updated (works perfectly). The problem is that I can not get it to call a
>page to the "main" frame. Redirect as I understand it will not redirect to
>a target frame. Does anyone know the solution or work around. Keep in
>mind that it is vital to refresh the TOC then call the "main" frame page.
>

This works in ASPX but not in ASCX?


<%# LCase(DateTime.Parse(DataBinder.Eval(dvProgramGrid, "[0].startTime")).ToString("htt")) %>

This works perfectly in my ASPX page, but when I put it in a user control I get the following error:

String reference not set to an instance of a String. Parameter name: s
Exception Details: System.ArgumentNullException: String reference not set to an instance of a String. Parameter name: s

I don't understand what's going on? Any help would be appreciated!Where is dvProgramGrid defined?
Thanks for your reply. Here is the code for the dataset and dataview:


Dim dsProgramGrid As DataSet
Dim dvProgramGrid As DataView
Dim startTime as string
Dim endTime as string
Sub Page_Load(Src As Object, E As EventArgs)
Dim conJSmenu As OleDbConnection
Dim dadJSmenu As OleDbDataAdapter

dsProgramGrid = New DataSet()
conJSmenu = New OleDbConnection( "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=D:\FTP\jgreenly\database\programGrid.mdb" )
dadJSmenu = New OleDbDataAdapter( "SELECT * FROM programGrid WHERE wkdy = ? AND startTime < ? ORDER BY startTime DESC", conJSmenu )
dadJSmenu.SelectCommand.Parameters.Add("@.wkdy", System.DateTime.Now.DayOfWeek.ToString)
dadJSmenu.SelectCommand.Parameters.Add("@.startTime", System.DateTime.Now.ToString("HH:mm"))
dadJSmenu.Fill( dsProgramGrid, "programGrid" )
dvProgramGrid = New DataView(dsProgramGrid.Tables("programGrid"))
Page.DataBind()
End Sub

this.Controls.Add()

I am developing a series of custom controls which get
added to a parent aspx container using the instruction
this.Controls.Add( myControl ). The parent application
creates an html table dynamically, and for each table row,
adds upwards of seven custom controls per row, which are
initially hidden. Custom controls are displayed based on
buttons the user clicks on a given row. When the
application processes renders table rows in an amount
greater than thirty, the application takes over 30 seconds
to render the entire page. We have used .NET profiler and
have determined the instruction this.Controls.Add(
myCustomControl ) is where execution time is being
consumed. My custom controls are simply c-sharp classes
with a Page_Load handler. These custom classes in turn
render a series of web-based .NET controls.

Why is the instruction this.Controls.Add() performing
slow? I have 1 gig of memory on my workstation.

SteveHi Steve,

Did this problem occur with a particualr custom control? For example, when
you add it with this.Controls.Add, it run slowly? If you add 30 same custom
controls, will this problem also occur?

Luke
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
Hi Luke,

Nope. The problem is apparent with all custom controls
added I've implemented. There are three main
this.Controls.Add( myControl ) calls in the top level
page_load. These calls are executed for each table row
rendered. There are thirty table rows in all. Each of the
custom controls added, may in turn nest other custom
controls which are added using this.Controls.Add(
myControl2 ). The .Net profiler has determined that these
calls are suspect and responsible for most of the
execution time. Ultimately the custom controls are
rendering a series of web controls. Now all of the custom
controls have a page_load event which gets called when the
control is added (i.e this.Controls.Add() ). Can I send
you an attachment of a sample custom control? How would I
direct an e-mail of this type using the web-client.

Steve Gagliardo

>--Original Message--
>Hi Steve,
>Did this problem occur with a particualr custom control?
For example, when
>you add it with this.Controls.Add, it run slowly? If you
add 30 same custom
>controls, will this problem also occur?
>Luke
>Microsoft Online Support
>Get Secure! www.microsoft.com/security
>(This posting is provided "AS IS", with no warranties,
and confers no
>rights.)
>.
Hi Steve,

With web-client, it is not be able to attach such a big project. To protect
your private code, I recommend you may submit a technial support incodent
for this issue. I think we need to analyst the source code of your custom
web control to find the problem. With a support incodent, this issue may be
resoved in a timely way. For detail, you may browse to:
support.microsoft.com.

Luke
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

Thought this would be simple

Thought I would work on setting certain UI elements dynamically. Sounded like an easy task until now. Any ideas how to resolve this error?

The ASPX page:

<%@dotnet.itags.org. Page Language="vb" AutoEventWireup="false" Codebehind="DynamicallyBuildTables.aspx.vb" Inherits="BookChp5a.DynamicallyBuildTables"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<title>DynamicallyBuildTables</title>
<meta name="GENERATOR" content="Microsoft Visual Studio .NET 7.1">
<meta name="CODE_LANGUAGE" content="Visual Basic .NET 7.1">
<meta name="vs_defaultClientScript" content="JavaScript">
<meta name="vs_targetSchema" content="http://schemas.microsoft.com/intellisense/ie5">
</HEAD>
<body>
<form id="Form1" method="post" runat="server">
<P>
Rows:
<asp:TextBox id="txtRows" runat="server" /> Cols:
<asp:TextBox id="txtCols" runat="server" /></P>
<P>
<asp:CheckBox id="chkBorder" runat="server" Text="Put border around Cells"></asp:CheckBox></P>
<P>
<asp:DropDownList id="ddl1" runat="server"></asp:DropDownList>
</P>
<P>
<asp:Button id="cmdCreate" runat="server" Text="Create"></asp:Button><BR>
</P>
<P>
<asp:Table id="Tbl1" runat="server">
<asp:TableRow ID="row" Runat="server">
<asp:TableCell id="cell" Runat="server" Text="A Test RowSpan">
<!-- Instead of using the Text property, you could add other
ASP.NET control tags here. --></asp:TableCell>
</asp:TableRow>
</asp:Table>
</P>
</form>
</body>
</HTML>


The code behind file:

Public Class DynamicallyBuildTables
Inherits System.Web.UI.Page
' Inherits System.Web.UI.WebControls
#Region " Web Form Designer Generated Code "

'This call is required by the Web Form Designer.
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()

End Sub
Protected WithEvents txtRows As System.Web.UI.WebControls.TextBox
Protected WithEvents txtCols As System.Web.UI.WebControls.TextBox
Protected WithEvents chkBorder As System.Web.UI.WebControls.CheckBox
Protected WithEvents cmdCreate As System.Web.UI.WebControls.Button
Protected WithEvents Tbl1 As System.Web.UI.WebControls.Table
Protected WithEvents ddl1 As System.Web.UI.WebControls.DropDownList

'NOTE: The following placeholder declaration is required by the Web Form Designer.
'Do not delete or move it.
Private designerPlaceholderDeclaration As System.Object

Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init
'CODEGEN: This method call is required by the Web Form Designer
'Do not modify it using the code editor.
InitializeComponent()
End Sub

#End Region

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'Put user code to initialize the page here
If IsPostBack = False Then
Tbl1.Visible = False
ddl1.Items.Add("Dashed")
ddl1.Items.Add("Dotted")
ddl1.Items.Add("Doubled")
ddl1.Items.Add("Groove")
ddl1.Items.Add("Inset")
ddl1.Items.Add("None")
ddl1.Items.Add("NotSet")
ddl1.Items.Add("Outset")
ddl1.Items.Add("Ridge")
ddl1.Items.Add("Solid")
Else
Tbl1.Visible = True
End If
' Tbl1.BorderStyle = BorderStyle.Inset
Tbl1.BorderWidth = Unit.Pixel(1)
End Sub

Private Sub cmdCreate_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdCreate.Click
'Remove all current rows and cells.
'This would not be necessary if you set
'EnableViewState = False.
Tbl1.Controls.Clear()
Dim strRows As String = txtRows.Text
Dim strCols As String = txtCols.Text
Dim strBorder As String = "BorderStyle." & ddl1.SelectedItem.Text
Dim i, j As Integer
For i = 1 To Val(strRows)
'Create a new tablerow object.
Dim rowNew As New TableRow
'put the new tablerow into the table object.
Tbl1.Controls.Add(rowNew)
For j = 1 To Val(strCols)
'Create a new TableCell object.
Dim cellNew As New TableCell
'***************************** standard text
'cellNew.Text = "Example Cell (" & i.ToString() & ","
'cellNew.Text &= j.ToString() & ")<br />"
'*****************************
'***************************** Added as objects
Dim lblNew As New Label
Dim imgNew As New System.Web.UI.WebControls.Image
imgNew.ImageUrl = "/images/smile.gif"
lblNew.Text = "hello"
cellNew.Controls.Add(lblNew)
cellNew.Controls.Add(imgNew)
'*****************************

If chkBorder.Checked Then
' Not working accurately, but dows show how to
' dynamically set border style.
txtCols.Text = strBorder
cellNew.BorderStyle = strBorder 'Bombs right here
cellNew.BorderWidth = Unit.Pixel(4)
End If
'Put the TableCell in the TableRow.
rowNew.Controls.Add(cellNew)
Next
Next
End Sub
End Class


Also, Is there a way to populate the ddl1.items.add("") list within the code and not hard coding?Also, Is there a way to populate the ddl1.items.add("") list within the code and not hard coding?

I'm not sure what you're trying to do.
I'm not sure what you're trying to do.

Would help if I explained it more. Sorry about that. :blush:

I am trying to dynamicaly assign the BorderStyle from the value in a string variable. The following line blows up:

cellNew.BorderStyle = strBorder 'Bombs right here

In addition to that, when you manually assign "BorderStyle." intellisense pops up with the listed values:

Dashed
Dotted
Doubled
Groove
Inset
None
NotSet
Outset
Ridge
Solid

I want to capture those values and place them into a DropDownList with out having to hard code. Instead of doing it like this:

ddl1.Items.Add("Dashed")

Can I code it to auto populate those values?

Any ideas?

Thoughts on getting away from so many aspx files....

Hi,

I have been working on a web project since the very early .net 2.0 days - around 13 months now but it seems to be getting very bulky. I have dozens of aspx files and many folders containing them! I also have way too many files in app_code.

I was thinking maybe I need single entry page - maybe written as a http handler which decides what to do and then loads content xml files to generate output. My concern here is I loose the benefits of master pages - I guess I could store all the xml files in the db but maintenance is harder then.

Any suggestions on this? What about the ever growing app_code folder?

Thanks

-c

what makes the concern for the number of files? Sure you could combine them, but isn't that going to make maintenance harder, instead of easier?

As for the pages themselves (the .aspx). If you want a different look on each, you'll have to use some custom skinning (css) and dynamic content. This will mean either lots of .css files and/or lots in the DB (or xmls) to layout each page. Not really going to save yourself anything...

As for the app_code.. same thing.. you can combine, but will it save you anything? Proper use of Master Pages, base pages and inheritance will get rid of A LOT of the code within the files, but as long as you have custom pages, you'll need the files. Dynamically adding controls can help with some reusability, but in the end its often not worth the headaches...

Thread

Hai Experts,
I have one aspx Page that updates lots of data to Active
Directory.This Part is done, But i need to display the status of
updation(That is How Many Entries are updated) for certain Period of time
and how many entries are pending to update. Is it possible through Threads,
can anyone please suggest me what to do.

Thanks,
Rajeev.I have done something similar, but it involved upload status instead. But,
I believe the concepts are similar. You want to display % complete, right?
It involved using an IFRAME (this showed the % complete). The main page
continued to process while the page in the IFRAME refreshed every couple of
seconds to determine what the status was.

I built an object that processed the upload and provided a % complete. The
page displaying the status complete interrogated that object for its status
while the other page did the work. I used threading and chunking (for the
upload) in this solution. I believe you could do something similar.

Sincerely,
John Swanagon
Sr. Software Engineer, Avaya Labs
Avaya Inc.
jmswanagon@.avaya.com
"RajeevSekar" <RajeevSekar@.force10networks.comwrote in message
news:uib3CF%23rGHA.4032@.TK2MSFTNGP03.phx.gbl...

Quote:

Originally Posted by

Hai Experts,
I have one aspx Page that updates lots of data to Active
Directory.This Part is done, But i need to display the status of
updation(That is How Many Entries are updated) for certain Period of time
and how many entries are pending to update. Is it possible through
Threads, can anyone please suggest me what to do.
>
Thanks,
Rajeev.
>

Thread issue/leak?

I am creating a worker thread from inside an aspx page and the thread does
the stuff it should do, no problem.
However, I have noticed running it in the debugger that it seems as if the
threads are not killed/garbage-collected after a thread terminates. I have a
breakpoint in the thread itself and every time it breaks, in the Threads
window I observe the new thread, but the previous thread is still there as
well. The exact same code in a windows app performs as expected, on every
break there are two threads, the main thread and the current worker thread.
The simplified code below also gives the same results, so nothing strange in
the thread itself. If I put the code in a loop of 2000 cycles and break
after the last, then there are 2000 worker threads displayed in the Threads
window.

Dim ttt As Thread = New Thread(AddressOf TheThreadProc)
ttt.ApartmentState = Threading.ApartmentState.STA
ttt.Start()
ttt.Join()

And the simple thread:

Private Sub TheThreadProc()
Dim iii As Integer = 10
End SubThis is because you are using a Single-Threaded Apartment. There is nothing
in the thread to receive messages. When you use COM in an ASP.Net
application, you create an Interop class that is disposable, and therefore,
the thread can be killed. IOW, don't use an STA thread unless you are doing
Interop.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
Everybody picks their nose,
But some people are better at hiding it.

"Chris Botha" <chris_s_botha@.AThotmail.com> wrote in message
news:uo5YHs9lFHA.2916@.TK2MSFTNGP14.phx.gbl...
>I am creating a worker thread from inside an aspx page and the thread does
> the stuff it should do, no problem.
> However, I have noticed running it in the debugger that it seems as if the
> threads are not killed/garbage-collected after a thread terminates. I have
> a
> breakpoint in the thread itself and every time it breaks, in the Threads
> window I observe the new thread, but the previous thread is still there as
> well. The exact same code in a windows app performs as expected, on every
> break there are two threads, the main thread and the current worker
> thread.
> The simplified code below also gives the same results, so nothing strange
> in
> the thread itself. If I put the code in a loop of 2000 cycles and break
> after the last, then there are 2000 worker threads displayed in the
> Threads
> window.
> Dim ttt As Thread = New Thread(AddressOf TheThreadProc)
> ttt.ApartmentState = Threading.ApartmentState.STA
> ttt.Start()
> ttt.Join()
> And the simple thread:
> Private Sub TheThreadProc()
> Dim iii As Integer = 10
> End Sub
Kevin, thanks for the response, however this is not it, I tested it without
STA before I posted the problem, same result.
The true thread is doing Interop, the simple example below is not (the
simple example produces the error/issue, with or without the STA statement).

"Kevin Spencer" <kevin@.DIESPAMMERSDIEtakempis.com> wrote in message
news:uhEpuHEmFHA.3300@.TK2MSFTNGP15.phx.gbl...
> This is because you are using a Single-Threaded Apartment. There is
> nothing in the thread to receive messages. When you use COM in an ASP.Net
> application, you create an Interop class that is disposable, and
> therefore, the thread can be killed. IOW, don't use an STA thread unless
> you are doing Interop.
> --
> HTH,
> Kevin Spencer
> Microsoft MVP
> .Net Developer
> Everybody picks their nose,
> But some people are better at hiding it.
> "Chris Botha" <chris_s_botha@.AThotmail.com> wrote in message
> news:uo5YHs9lFHA.2916@.TK2MSFTNGP14.phx.gbl...
>>I am creating a worker thread from inside an aspx page and the thread does
>> the stuff it should do, no problem.
>> However, I have noticed running it in the debugger that it seems as if
>> the
>> threads are not killed/garbage-collected after a thread terminates. I
>> have a
>> breakpoint in the thread itself and every time it breaks, in the Threads
>> window I observe the new thread, but the previous thread is still there
>> as
>> well. The exact same code in a windows app performs as expected, on every
>> break there are two threads, the main thread and the current worker
>> thread.
>> The simplified code below also gives the same results, so nothing strange
>> in
>> the thread itself. If I put the code in a loop of 2000 cycles and break
>> after the last, then there are 2000 worker threads displayed in the
>> Threads
>> window.
>>
>> Dim ttt As Thread = New Thread(AddressOf TheThreadProc)
>> ttt.ApartmentState = Threading.ApartmentState.STA
>> ttt.Start()
>> ttt.Join()
>>
>> And the simple thread:
>>
>> Private Sub TheThreadProc()
>> Dim iii As Integer = 10
>> End Sub
>>
>>
Are you setting the "aspcompat" attribute?

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
Everybody picks their nose,
But some people are better at hiding it.

"Chris Botha" <chris_s_botha@.AThotmail.com> wrote in message
news:OqkgITEmFHA.708@.TK2MSFTNGP09.phx.gbl...
> Kevin, thanks for the response, however this is not it, I tested it
> without STA before I posted the problem, same result.
> The true thread is doing Interop, the simple example below is not (the
> simple example produces the error/issue, with or without the STA
> statement).
> "Kevin Spencer" <kevin@.DIESPAMMERSDIEtakempis.com> wrote in message
> news:uhEpuHEmFHA.3300@.TK2MSFTNGP15.phx.gbl...
>> This is because you are using a Single-Threaded Apartment. There is
>> nothing in the thread to receive messages. When you use COM in an ASP.Net
>> application, you create an Interop class that is disposable, and
>> therefore, the thread can be killed. IOW, don't use an STA thread unless
>> you are doing Interop.
>>
>> --
>> HTH,
>>
>> Kevin Spencer
>> Microsoft MVP
>> .Net Developer
>> Everybody picks their nose,
>> But some people are better at hiding it.
>>
>> "Chris Botha" <chris_s_botha@.AThotmail.com> wrote in message
>> news:uo5YHs9lFHA.2916@.TK2MSFTNGP14.phx.gbl...
>>>I am creating a worker thread from inside an aspx page and the thread
>>>does
>>> the stuff it should do, no problem.
>>> However, I have noticed running it in the debugger that it seems as if
>>> the
>>> threads are not killed/garbage-collected after a thread terminates. I
>>> have a
>>> breakpoint in the thread itself and every time it breaks, in the Threads
>>> window I observe the new thread, but the previous thread is still there
>>> as
>>> well. The exact same code in a windows app performs as expected, on
>>> every
>>> break there are two threads, the main thread and the current worker
>>> thread.
>>> The simplified code below also gives the same results, so nothing
>>> strange in
>>> the thread itself. If I put the code in a loop of 2000 cycles and break
>>> after the last, then there are 2000 worker threads displayed in the
>>> Threads
>>> window.
>>>
>>> Dim ttt As Thread = New Thread(AddressOf TheThreadProc)
>>> ttt.ApartmentState = Threading.ApartmentState.STA
>>> ttt.Start()
>>> ttt.Join()
>>>
>>> And the simple thread:
>>>
>>> Private Sub TheThreadProc()
>>> Dim iii As Integer = 10
>>> End Sub
>>>
>>>
>>
>>
Also, Chris, as you didn't post your actual code, I can't really guess what
the problem is. However, I believe you can find your answers at one or more
of the following MSDN articles (and related links):

http://msdn.microsoft.com/library/e...asp?frame=true
http://msdn.microsoft.com/library/e...asp?frame=true

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
Everybody picks their nose,
But some people are better at hiding it.

"Chris Botha" <chris_s_botha@.AThotmail.com> wrote in message
news:OqkgITEmFHA.708@.TK2MSFTNGP09.phx.gbl...
> Kevin, thanks for the response, however this is not it, I tested it
> without STA before I posted the problem, same result.
> The true thread is doing Interop, the simple example below is not (the
> simple example produces the error/issue, with or without the STA
> statement).
> "Kevin Spencer" <kevin@.DIESPAMMERSDIEtakempis.com> wrote in message
> news:uhEpuHEmFHA.3300@.TK2MSFTNGP15.phx.gbl...
>> This is because you are using a Single-Threaded Apartment. There is
>> nothing in the thread to receive messages. When you use COM in an ASP.Net
>> application, you create an Interop class that is disposable, and
>> therefore, the thread can be killed. IOW, don't use an STA thread unless
>> you are doing Interop.
>>
>> --
>> HTH,
>>
>> Kevin Spencer
>> Microsoft MVP
>> .Net Developer
>> Everybody picks their nose,
>> But some people are better at hiding it.
>>
>> "Chris Botha" <chris_s_botha@.AThotmail.com> wrote in message
>> news:uo5YHs9lFHA.2916@.TK2MSFTNGP14.phx.gbl...
>>>I am creating a worker thread from inside an aspx page and the thread
>>>does
>>> the stuff it should do, no problem.
>>> However, I have noticed running it in the debugger that it seems as if
>>> the
>>> threads are not killed/garbage-collected after a thread terminates. I
>>> have a
>>> breakpoint in the thread itself and every time it breaks, in the Threads
>>> window I observe the new thread, but the previous thread is still there
>>> as
>>> well. The exact same code in a windows app performs as expected, on
>>> every
>>> break there are two threads, the main thread and the current worker
>>> thread.
>>> The simplified code below also gives the same results, so nothing
>>> strange in
>>> the thread itself. If I put the code in a loop of 2000 cycles and break
>>> after the last, then there are 2000 worker threads displayed in the
>>> Threads
>>> window.
>>>
>>> Dim ttt As Thread = New Thread(AddressOf TheThreadProc)
>>> ttt.ApartmentState = Threading.ApartmentState.STA
>>> ttt.Start()
>>> ttt.Join()
>>>
>>> And the simple thread:
>>>
>>> Private Sub TheThreadProc()
>>> Dim iii As Integer = 10
>>> End Sub
>>>
>>>
>>
>>
worker threads should be terminated, as you showed code of one
statement.
There would be 2000 (caller) main threads waiting for worker to be
terminated.

If you are saying worker thread (small one statement proc) is not
terminating (GC)
then Caller threads must also be alive.

Check ttt.IsAlive and do ttt.Abort() and ttt = Nothing
and test.

The (worker thread) code is being called by pageclass which is also
generated by some other asp.net parent thread (if that is calling abort
or someother stuff on the thread of pageclass this could affect).

Do let us know of your proceedings.

--
hB

Thread issue/leak?

I am creating a worker thread from inside an aspx page and the thread does
the stuff it should do, no problem.
However, I have noticed running it in the debugger that it seems as if the
threads are not killed/garbage-collected after a thread terminates. I have a
breakpoint in the thread itself and every time it breaks, in the Threads
window I observe the new thread, but the previous thread is still there as
well. The exact same code in a windows app performs as expected, on every
break there are two threads, the main thread and the current worker thread.
The simplified code below also gives the same results, so nothing strange in
the thread itself. If I put the code in a loop of 2000 cycles and break
after the last, then there are 2000 worker threads displayed in the Threads
window.
Dim ttt As Thread = New Thread(AddressOf TheThreadProc)
ttt.ApartmentState = Threading.ApartmentState.STA
ttt.Start()
ttt.Join()
And the simple thread:
Private Sub TheThreadProc()
Dim iii As Integer = 10
End SubThis is because you are using a Single-Threaded Apartment. There is nothing
in the thread to receive messages. When you use COM in an ASP.Net
application, you create an Interop class that is disposable, and therefore,
the thread can be killed. IOW, don't use an STA thread unless you are doing
Interop.
HTH,
Kevin Spencer
Microsoft MVP
.Net Developer
Everybody picks their nose,
But some people are better at hiding it.
"Chris Botha" <chris_s_botha@.AThotmail.com> wrote in message
news:uo5YHs9lFHA.2916@.TK2MSFTNGP14.phx.gbl...
>I am creating a worker thread from inside an aspx page and the thread does
> the stuff it should do, no problem.
> However, I have noticed running it in the debugger that it seems as if the
> threads are not killed/garbage-collected after a thread terminates. I have
> a
> breakpoint in the thread itself and every time it breaks, in the Threads
> window I observe the new thread, but the previous thread is still there as
> well. The exact same code in a windows app performs as expected, on every
> break there are two threads, the main thread and the current worker
> thread.
> The simplified code below also gives the same results, so nothing strange
> in
> the thread itself. If I put the code in a loop of 2000 cycles and break
> after the last, then there are 2000 worker threads displayed in the
> Threads
> window.
> Dim ttt As Thread = New Thread(AddressOf TheThreadProc)
> ttt.ApartmentState = Threading.ApartmentState.STA
> ttt.Start()
> ttt.Join()
> And the simple thread:
> Private Sub TheThreadProc()
> Dim iii As Integer = 10
> End Sub
>
Kevin, thanks for the response, however this is not it, I tested it without
STA before I posted the problem, same result.
The true thread is doing Interop, the simple example below is not (the
simple example produces the error/issue, with or without the STA statement).
"Kevin Spencer" <kevin@.DIESPAMMERSDIEtakempis.com> wrote in message
news:uhEpuHEmFHA.3300@.TK2MSFTNGP15.phx.gbl...
> This is because you are using a Single-Threaded Apartment. There is
> nothing in the thread to receive messages. When you use COM in an ASP.Net
> application, you create an Interop class that is disposable, and
> therefore, the thread can be killed. IOW, don't use an STA thread unless
> you are doing Interop.
> --
> HTH,
> Kevin Spencer
> Microsoft MVP
> .Net Developer
> Everybody picks their nose,
> But some people are better at hiding it.
> "Chris Botha" <chris_s_botha@.AThotmail.com> wrote in message
> news:uo5YHs9lFHA.2916@.TK2MSFTNGP14.phx.gbl...
>
Are you setting the "aspcompat" attribute?
HTH,
Kevin Spencer
Microsoft MVP
.Net Developer
Everybody picks their nose,
But some people are better at hiding it.
"Chris Botha" <chris_s_botha@.AThotmail.com> wrote in message
news:OqkgITEmFHA.708@.TK2MSFTNGP09.phx.gbl...
> Kevin, thanks for the response, however this is not it, I tested it
> without STA before I posted the problem, same result.
> The true thread is doing Interop, the simple example below is not (the
> simple example produces the error/issue, with or without the STA
> statement).
> "Kevin Spencer" <kevin@.DIESPAMMERSDIEtakempis.com> wrote in message
> news:uhEpuHEmFHA.3300@.TK2MSFTNGP15.phx.gbl...
>
Also, Chris, as you didn't post your actual code, I can't really guess what
the problem is. However, I believe you can find your answers at one or more
of the following MSDN articles (and related links):
http://msdn.microsoft.com/library/e...
me=true
http://msdn.microsoft.com/library/e...br />
ame=true
HTH,
Kevin Spencer
Microsoft MVP
.Net Developer
Everybody picks their nose,
But some people are better at hiding it.
"Chris Botha" <chris_s_botha@.AThotmail.com> wrote in message
news:OqkgITEmFHA.708@.TK2MSFTNGP09.phx.gbl...
> Kevin, thanks for the response, however this is not it, I tested it
> without STA before I posted the problem, same result.
> The true thread is doing Interop, the simple example below is not (the
> simple example produces the error/issue, with or without the STA
> statement).
> "Kevin Spencer" <kevin@.DIESPAMMERSDIEtakempis.com> wrote in message
> news:uhEpuHEmFHA.3300@.TK2MSFTNGP15.phx.gbl...
>
worker threads should be terminated, as you showed code of one
statement.
There would be 2000 (caller) main threads waiting for worker to be
terminated.
If you are saying worker thread (small one statement proc) is not
terminating (GC)
then Caller threads must also be alive.
Check ttt.IsAlive and do ttt.Abort() and ttt = Nothing
and test.
The (worker thread) code is being called by pageclass which is also
generated by some other asp.net parent thread (if that is calling abort
or someother stuff on the thread of pageclass this could affect).
Do let us know of your proceedings.
hB

Tuesday, March 13, 2012

Thread was being aborted

Hi,

I have an ASPX page that does a Response.Redirect.

I get a message stating "Thread was being aborted".

The page I am redirecting to only have 2 lines of VB.

Anyone know why I am getting this error?

Thanks,
C.You may try "Response.Redirect ("aspxName.aspx",false)".

Thread was being aborted exception in user control

I have an .ascx user control for creating dynamic charts from a datatable, which uses an external .aspx page for rendering the chart as a .png image. The control is not functioning as expected (ie. the chart image is not being saved in the specified folder), with the containing page catching a "Thread was being aborted" exception. The containing page itself is rendered correctly, and there is no further use of Response.Redirect or Server.Transfer after the page is loaded. Could the exception arise from the statement within the code behind file of the control where the control's image source is set:
imgGDI.imageURL = "somepage.apsx"
or is the only source likely to be the previous Server.Transfer call to the containing page? I have read other threads regarding the 'Thread was being aborted' exception and Try...Catch blocks, but the solutions detailed do not seem to have any effect.
Any suggestions most welcome.The Thread being aborted exception is the natural generation of a Server.Transfer or Response.Redirect. However a Reponse.Redirect has an option to supress the exception. Response.Redirect("foo.aspx", false);
We're using Server.Transfer("foo.aspx", false). The problem seems to be intermittant at the moment though, which is why I thought the problem may be to do with the external .aspx pages being used for the image source.