Monday, March 26, 2012
Newbie Advice: UserInteractive mode
I am new to ASP.NET making the move over from windows forms development.
In Windows forms I used to throw an error to a windows form or a message box when I wanted to alert the user about something i.e. invalid password on login.
I would like to know if it is better to place the application into "UserInteractive mode" and use standard dialog boxes or should i be creating pages to report such things.
Any applications I produce will be restricted to the local Intranet.
Any advice appreciated.You can't use standard dialog boxes in a webpage as these are for windows forms (well ok you can get them to work in a sense but they will only display on the server which wouldn't be any good to you).
For small messages such as 'login details not recognised' I'd just display them in a label on the page (I know as a user i'd also prefer this than rather having to close a messagebox everytime).
For application errors incorporate error handling to catch them.
Hi,
many thanks for your response.
Of course you are correct, I forgot that this will now be server based rather than client as I am used to. I didn't consider that the dialogs would appear local to the server.
I will go down the path of using alert screens/labels to return responses to the end user.
Thank you
It'll be simple. You'll use
Page.RegisterStartupScript("myalert","<script language='JavaScript'>alert('" + somevariable + "');</script>");
Saturday, March 24, 2012
Newbie Embedded WUC DLL Question
I've been racking my brains trying to figure out what's going on with
my embedded .NET 2.0 windows user control.
I've developed a Windows Forms application using Visual C# 2005
Express. I'm interested in migrating it to the web as an embedded
windows user control.
As a proof of concept, I've been playing around embedding some very
basic Windows user controls into both HTML and ASP pages using Visual
Web Developer 2005 Express. (My web development is very limited).
I've done some searching and found examples of how to embed a user
control as an object by inserting something like the following
(<OBJECT id="myObject" classid="myDll.dll#myNamespace.myControl"
height=480 width=480></OBJECT>) into HTML code and copying the DLL
file in the 'root' (not /bin) directory of the page.
Now here's where the fun comes in...
I'm testing some very basic embedded controls using Microsoft's
ASP.NET Development server and I'm getting some very odd and
unexplained behavior.
1) When I create a new website project and insert the control, most of
the time (but not always) my sample control will display in the
internal browser inside the Visual Web Developer IDE and it will
display in IE (as launched from the Visual Web Developer IDE in debug
mode)
2) If I change the embedded user control code (inside Visual C#
Express) and recompile and re-copy the DLL file into the web project
directory, I very rarely see the updates reflected in the user
control. It seems to be using a cached version of the DLL??
3) Eventually, I will reach a state where the user control no longer
even appears in the web browser window when trying to run the site
(using the Development Server). It only shows up as an object icon
place holder.
I've tried all sorts of things like:
1) Stopping the development server before copying the new DLL file
into the web project
2) Restarting Visual Web Developer Express
3) Deleting all the temporary IE files
4) Deleting all the files from C:\WINDOWS\Microsoft.NET\Framework
\v2.0.50727\Temporary ASP.NET Files\
None of those attempts seems to change what I'm observing - why only
sometimes the embedded control displays and why none of the re-
compiles/re-copying of the DLL files seem to 'take effect'. Also,
once the control stops displaying, I essentially have to create an
entirely new web project to see the control again.
Any thoughts/links to examples or suggestions would be greatly
appreciated.
Thanks,
Mike D.the control is cached in two places
1) ie caches the dll in its temp area (use delete temp files in ie).
2) the gac caches the jit'd code. use gacutil /cdl
note: this is probably a dead-end approach. you should look at
Silverlight as a more long term solution.
-- bruce (sqlwork.com)
mdemase@.gmail.com wrote:
Quote:
Originally Posted by
Hello -
>
I've been racking my brains trying to figure out what's going on with
my embedded .NET 2.0 windows user control.
>
I've developed a Windows Forms application using Visual C# 2005
Express. I'm interested in migrating it to the web as an embedded
windows user control.
>
As a proof of concept, I've been playing around embedding some very
basic Windows user controls into both HTML and ASP pages using Visual
Web Developer 2005 Express. (My web development is very limited).
I've done some searching and found examples of how to embed a user
control as an object by inserting something like the following
(<OBJECT id="myObject" classid="myDll.dll#myNamespace.myControl"
height=480 width=480></OBJECT>) into HTML code and copying the DLL
file in the 'root' (not /bin) directory of the page.
>
Now here's where the fun comes in...
>
I'm testing some very basic embedded controls using Microsoft's
ASP.NET Development server and I'm getting some very odd and
unexplained behavior.
>
1) When I create a new website project and insert the control, most of
the time (but not always) my sample control will display in the
internal browser inside the Visual Web Developer IDE and it will
display in IE (as launched from the Visual Web Developer IDE in debug
mode)
>
2) If I change the embedded user control code (inside Visual C#
Express) and recompile and re-copy the DLL file into the web project
directory, I very rarely see the updates reflected in the user
control. It seems to be using a cached version of the DLL??
>
3) Eventually, I will reach a state where the user control no longer
even appears in the web browser window when trying to run the site
(using the Development Server). It only shows up as an object icon
place holder.
>
I've tried all sorts of things like:
1) Stopping the development server before copying the new DLL file
into the web project
2) Restarting Visual Web Developer Express
3) Deleting all the temporary IE files
4) Deleting all the files from C:\WINDOWS\Microsoft.NET\Framework
\v2.0.50727\Temporary ASP.NET Files\
>
None of those attempts seems to change what I'm observing - why only
sometimes the embedded control displays and why none of the re-
compiles/re-copying of the DLL files seem to 'take effect'. Also,
once the control stops displaying, I essentially have to create an
entirely new web project to see the control again.
>
Any thoughts/links to examples or suggestions would be greatly
appreciated.
>
Thanks,
Mike D.
>
Newbie Forms Question
Hello All -
I have intermediate experience with MS SQL 2000 Server Programming and now getting into .net, ASP.net, VB.net and ADO.net to be more specific.
I was given this simple project to build a data entry form to insert some data in a SQL table. I have the form ready and need some help on how to take the data from my form (text box, drop downs) and send to my sql table, I've read some articles about data adapter but still not sure how to use that.
I'm also consfused between using the code on the web page or the code behind.
Any light you guys can shed will be welcome, thanks in advance.
Depends on what version of ASP.NET you're working with. If using 2.0, then I suggest you read through the following. Lots of info there with examples...http://www.asp.net/QuickStart/aspnet/Default.aspx
Newbie generic header question...
I want to have a generic header for all my web forms, so what is generally
recognized as the best way to achieve this:
have all forms inherit from a base page?
style sheet?
Any thoughts would be greatly appreciated...
TIA
Colin BHi Colin,
Create a user control for header information and use it in all your web
forms.It gives you the reusability.
Here is a link on MSDN:
http://msdn.microsoft.com/library/d...sercontrols.asp
Hope this helps.
Regards,
Marshal Antony
..NET Developer
http://www.dotnetmarshal.com
"Colin Basterfield" <colinbasterfield@.hotmail.com> wrote in message
news:Oe9DBWaAEHA.2040@.TK2MSFTNGP12.phx.gbl...
> Hi,
> I want to have a generic header for all my web forms, so what is generally
> recognized as the best way to achieve this:
> have all forms inherit from a base page?
> style sheet?
> Any thoughts would be greatly appreciated...
> TIA
> Colin B
Friday, March 16, 2012
Newbie Needs Help
I am coming up with an error and don't know how to fix it... Please help me!!!!
Server Error in '/ReadOnly' Application.
------------------------
Compilation Error
Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.
Compiler Error Message: BC30180: Keyword does not name a type.
Source Error:
Line 31: <System.Runtime.CompilerServices.CompilerGlobalScopeAttribute()> _
Line 32: Public Class Global_asax
Line 33: Inherits ReadOnly.Global
Line 34:
Line 35: Private Shared __initialized As Boolean = false
Source File: C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\Temporary ASP.NET Files\readonly\cc5ec6d7\7a0c1c27\-u9u0vh1.0.vb Line: 33Please provide code. This will help in determinig the problem...
the code for the page that I have written is
Public Class WebForm1
Inherits System.Web.UI.Page
#Region " Web Form Designer Generated Code "
'This call is required by the Web Form Designer.
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
Me.OleDbConnection1 = New System.Data.OleDb.OleDbConnection
Me.OleDbCommand1 = New System.Data.OleDb.OleDbCommand
'
'OleDbConnection1
'
Me.OleDbConnection1.ConnectionString = "Integrated Security=SSPI;Packet Size=4096;Data Source=018744S;Tag with column col" & _
"lation when possible=False;Initial Catalog=pubs;Use Procedure for Prepare=1;Auto" & _
" Translate=True;Persist Security Info=False;Provider=""SQLOLEDB.1"";Workstation ID" & _
"=018744S;Use Encryption for Data=False"
'
'OleDbCommand1
'
Me.OleDbCommand1.CommandText = "SELECT au_id, au_fname, au_lname, phone FROM authors"
Me.OleDbCommand1.Connection = Me.OleDbConnection1
End Sub
Protected WithEvents OleDbConnection1 As System.Data.OleDb.OleDbConnection
Protected WithEvents OleDbCommand1 As System.Data.OleDb.OleDbCommand
Protected WithEvents DataGrid1 As System.Web.UI.WebControls.DataGrid
'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 Not IsPostBack Then
OleDbConnection1.Open()
Dim Reader As System.Data.OleDb.OleDbDataReader
Reader = OleDbCommand1.ExecuteReader()
DataGrid1.DataSource = Reader
DataGrid1.DataBind()
Reader.Close()
OleDbConnection1.Close()
End If
End Sub
Private Sub OleDbConnection1_InfoMessage(ByVal sender As System.Object, ByVal e As System.Data.OleDb.OleDbInfoMessageEventArgs) Handles OleDbConnection1.InfoMessage
End Sub
End Class