Showing posts with label visual. Show all posts
Showing posts with label visual. Show all posts

Saturday, March 31, 2012

String to date error

Hi guys Ive got a slight problem..

When i run my asp.net page through visual studio the application works fine, however when i puslish it and view it over myhttp://localhost page i get the following error "Conversion from string "28/8/2007" to type 'Date' is not valid." when selecting dates from a calendar control i created.

Im thinking this is some formatting issue having to do with EU/US Date format, however im not too sure about it and with a few research there are some help files stating to use globalization and once again im not sure how that works.

What im doing is assigning a date within an arraylist (which are of type dates) to a Date variable as below

Dim tempDate asDatetempDate = NewDate.Item(0) // arraylist of containing dates
Would appreciate some help regarding this issue

Thanks :)

It is a en-eu related problem. This article should help

http://msdn2.microsoft.com/en-us/library/2h3syy57.aspx
thanks that was interesting, also found out that the root to the problem was due to regional settings under the aspnet user account, my currently logged on account was set to UK however the user account aspnet was still on US therefore it kept showing dates in US format

Monday, March 26, 2012

StringBuilder

can anyone tell me how to declare a stringbuilder using vb in visual studio, I am trying to use a stringbuilder in the following code, but visual studio states stringbuilder is not defined.

Imports System.Data
Imports System.Data.SqlClient
Imports System.Text.StringBuilder

Public Class datagrid2
Inherits System.Web.UI.Page

Public Sub UpdateCommand(ByVal sender As Object, ByVal e As DataGridCommandEventArgs)

Dim sb1 As StringBuilder = New StringBuilder("")
sb1.Append("INSERT Employees (firstname, lastname, titleofcourtesy, title, country) VALUES(")
sb1.Append("@dotnet.itags.org.sFirstName, @dotnet.itags.org.sLastName, @dotnet.itags.org.sTitle, @dotnet.itags.org.sPosition, @dotnet.itags.org.sCountry)")
cmd.CommandText = sb1.ToString()Hi,

Dim sb1 As System.Text.StringBuilder = New System.Text.StringBuilder("")

HTH
Imports System.Text.StringBuilder <-- don't do this, StringBuilder is a class, not a namespace.

use:
Imports System.Text

now you can use "StringBuilder" in your code (instead of having to write the fully qualified version of it each time)
thanks guys

Saturday, March 24, 2012

Strip Visual Studio META Tags Is Safe?

I have these in all of my pages:

<meta name="GENERATOR" Content="Microsoft Visual Studio .NET 7.1">
<meta name="CODE_LANGUAGE" Content="C#">
<meta name=vs_defaultClientScript content="JavaScript">
<meta name=vs_targetSchema
content="http://schemas.microsoft.com/intellisense/ie5"
And I am wondering if it is safe to remove them after I compile the
ASP.NET application, or if it is possible to have VS.NET 2003 not put
them in my .aspx pages in the first place.

Thanks.meta tags are not rendered, they are only used to provide information to the
server and the client. They can be deleted at will, if you don't need them.
Removing the target schema and client script meta tags will remove some
intellisense features on the development environment, but nothing contained
in a meta tag will affect the rendering of the page itself.

--
Chris Jackson
Software Engineer
Microsoft MVP - Windows Client
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)
--

"localhost" <primpilus@.cohort.ces> wrote in message
news:3ubf20p4i2t4k30u4je2hjmv5atl7g4e4v@.4ax.com...
>I have these in all of my pages:
> <meta name="GENERATOR" Content="Microsoft Visual Studio .NET 7.1">
> <meta name="CODE_LANGUAGE" Content="C#">
> <meta name=vs_defaultClientScript content="JavaScript">
> <meta name=vs_targetSchema
> content="http://schemas.microsoft.com/intellisense/ie5">
> And I am wondering if it is safe to remove them after I compile the
> ASP.NET application, or if it is possible to have VS.NET 2003 not put
> them in my .aspx pages in the first place.
> Thanks.
Hi Localhost,

Thanks for posting in the community!
From your description, you are wondering some infos on the <meta> tags
VS.NET has automatically put in the ASP.NET page when page is created and
whether it'll cause any problem if remove them, yes?
If there is anything I misunderstood, please feel free to let me know.

As for this problem, I agree to Chris's opinion, the meta tags commonly
tells web browsers basic host information about a site or the tools that
created the source files of the site. This information is also used by
search engines. For detailed info on the META tags, you may view the
following web references:

#META - Metadata
http://www.htmlhelp.com/reference/html40/head/meta.html

#HTML Tutorial -> META - Metadata
http://www.style-sheets.com/html_tutorial/head/meta.asp

Regards,

Steven Cheng
Microsoft Online Support

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

Strnge characters causing compilation error

hi,

i am hoping that someone may be able to help me... i have been writing
vb.net pages using visual web developer. they all work fine locally
however when i upload to the server i get the following error:

Compiler Error Message: BC30037: Character is not valid.

it looks as if some strange characters have been added to the end of
every line of code causing the script to error. see the page here:
http://www.albamclothing.com/register.aspx
doe anyone know what may cause this? or even better how to get rid of
them?

many thanksIt may be the strange return character that word puts in, Ive only seen this
when moving from a windows environment to a unix environment before, but if
there is some sort of FTP going on when youre uploading I'd suggest putting
the FTP client in BINARY mode before uploading...

Regards

Rod
<tom_burrow@.umbro.co.ukwrote in message
news:1158137142.668189.67720@.e63g2000cwd.googlegro ups.com...

Quote:

Originally Posted by

hi,
>
i am hoping that someone may be able to help me... i have been writing
vb.net pages using visual web developer. they all work fine locally
however when i upload to the server i get the following error:
>
Compiler Error Message: BC30037: Character is not valid.
>
it looks as if some strange characters have been added to the end of
every line of code causing the script to error. see the page here:
http://www.albamclothing.com/register.aspx
>
doe anyone know what may cause this? or even better how to get rid of
them?
>
many thanks
>

Thursday, March 22, 2012

structure

Muhammad,

I assume you mean the Visual style of the pages?

There are a few ways this can be done, I personally use
WilsonMasterPages: -

http://authors.aspalliance.com/Paul...Articles/?id=14

Hth,
Phil Winstanley
Microsoft ASP.NET MVP
http://www.myservicescentral.comsorry didn't make myself clear, I want to use a data structure and assign
values to its members on different pages and offcourse want to retain all
values assigned on different pages.

"Phil Winstanley [Microsoft MVP ASP.NET]" <phil@.winstanley.name> wrote in
message news:camdst$oni@.odak26.prod.google.com...
> Muhammad,
> I assume you mean the Visual style of the pages?
> There are a few ways this can be done, I personally use
> WilsonMasterPages: -
> http://authors.aspalliance.com/Paul...Articles/?id=14
> Hth,
> Phil Winstanley
> Microsoft ASP.NET MVP
> http://www.myservicescentral.com
Muhammad,

You could store this structure in the Application object, and update it
there. Although you may have threading issues, so use locking when
accessing it.

James

"Muhammad Sheikh" <Muhammad.Sheikh@.4mat.com> wrote in message
news:eFIQYgrUEHA.2388@.TK2MSFTNGP09.phx.gbl...
> sorry didn't make myself clear, I want to use a data structure and assign
> values to its members on different pages and offcourse want to retain all
> values assigned on different pages.
> "Phil Winstanley [Microsoft MVP ASP.NET]" <phil@.winstanley.name> wrote in
> message news:camdst$oni@.odak26.prod.google.com...
> > Muhammad,
> > I assume you mean the Visual style of the pages?
> > There are a few ways this can be done, I personally use
> > WilsonMasterPages: -
> > http://authors.aspalliance.com/Paul...Articles/?id=14
> > Hth,
> > Phil Winstanley
> > Microsoft ASP.NET MVP
> > http://www.myservicescentral.com
Is it possible to definte a user defined stucture as application variable.
just of the sake of example

public struct student
{
int id;
string name;
float age;
string address1;
string address2;
}

How can I create an object of student type as an application variable?

"James Doran" <jamied1@.NO_SPAMbreathe.com> wrote in message
news:e4qMukrUEHA.2520@.TK2MSFTNGP10.phx.gbl...
> Muhammad,
> You could store this structure in the Application object, and update it
> there. Although you may have threading issues, so use locking when
> accessing it.
> James
> "Muhammad Sheikh" <Muhammad.Sheikh@.4mat.com> wrote in message
> news:eFIQYgrUEHA.2388@.TK2MSFTNGP09.phx.gbl...
> > sorry didn't make myself clear, I want to use a data structure and
assign
> > values to its members on different pages and offcourse want to retain
all
> > values assigned on different pages.
> > "Phil Winstanley [Microsoft MVP ASP.NET]" <phil@.winstanley.name> wrote
in
> > message news:camdst$oni@.odak26.prod.google.com...
> > > Muhammad,
> > > > I assume you mean the Visual style of the pages?
> > > > There are a few ways this can be done, I personally use
> > > WilsonMasterPages: -
> > > > http://authors.aspalliance.com/Paul...Articles/?id=14
> > > > Hth,
> > > Phil Winstanley
> > > Microsoft ASP.NET MVP
> > > http://www.myservicescentral.com
>
Define the struct as you have in a file within your project. In the
Application_Start event handler in the Global.asax file of your project,
enter the following code:

VB:
Dim oStudent As SomeNamespace.student
' Initialise
oStudent.ID = 0
oStudent.Age = 15
...

' Add the student to the application object
Application("Student") = oStudent

C#:
SomeNamespace.student oStudent;
// Initialise
oStudent.ID = 0;
oStudent.Age = 15;
...

// Add the student to the application object
Application["Student"] = oStudent;

The student struct will then be available to each page. To access it, use
the following code:

VB:
CType(Application("Student"), SomeNamespace.student) ...

C#:
(SomeNamespace.student)Application["Student"] ...

Hope this helps,

James

"Muhammad Sheikh" <Muhammad.Sheikh@.4mat.com> wrote in message
news:uTCmXtrUEHA.2972@.TK2MSFTNGP12.phx.gbl...
> Is it possible to definte a user defined stucture as application variable.
> just of the sake of example
> public struct student
> {
> int id;
> string name;
> float age;
> string address1;
> string address2;
> }
> How can I create an object of student type as an application variable?
> "James Doran" <jamied1@.NO_SPAMbreathe.com> wrote in message
> news:e4qMukrUEHA.2520@.TK2MSFTNGP10.phx.gbl...
> > Muhammad,
> > You could store this structure in the Application object, and update it
> > there. Although you may have threading issues, so use locking when
> > accessing it.
> > James
> > "Muhammad Sheikh" <Muhammad.Sheikh@.4mat.com> wrote in message
> > news:eFIQYgrUEHA.2388@.TK2MSFTNGP09.phx.gbl...
> > > sorry didn't make myself clear, I want to use a data structure and
> assign
> > > values to its members on different pages and offcourse want to retain
> all
> > > values assigned on different pages.
> > > > "Phil Winstanley [Microsoft MVP ASP.NET]" <phil@.winstanley.name> wrote
> in
> > > message news:camdst$oni@.odak26.prod.google.com...
> > > > Muhammad,
> > > > > > I assume you mean the Visual style of the pages?
> > > > > > There are a few ways this can be done, I personally use
> > > > WilsonMasterPages: -
> > > > > > http://authors.aspalliance.com/Paul...Articles/?id=14
> > > > > > Hth,
> > > > Phil Winstanley
> > > > Microsoft ASP.NET MVP
> > > > http://www.myservicescentral.com
> > > >
Excellent! that make 100% sense, will give it a go now thank you for help.

"James Doran" <jamied1@.NO_SPAMbreathe.com> wrote in message
news:u2jIuzrUEHA.1036@.TK2MSFTNGP12.phx.gbl...
> Define the struct as you have in a file within your project. In the
> Application_Start event handler in the Global.asax file of your project,
> enter the following code:
> VB:
> Dim oStudent As SomeNamespace.student
> ' Initialise
> oStudent.ID = 0
> oStudent.Age = 15
> ...
> ' Add the student to the application object
> Application("Student") = oStudent
> C#:
> SomeNamespace.student oStudent;
> // Initialise
> oStudent.ID = 0;
> oStudent.Age = 15;
> ...
> // Add the student to the application object
> Application["Student"] = oStudent;
> The student struct will then be available to each page. To access it, use
> the following code:
> VB:
> CType(Application("Student"), SomeNamespace.student) ...
> C#:
> (SomeNamespace.student)Application["Student"] ...
> Hope this helps,
> James
> "Muhammad Sheikh" <Muhammad.Sheikh@.4mat.com> wrote in message
> news:uTCmXtrUEHA.2972@.TK2MSFTNGP12.phx.gbl...
> > Is it possible to definte a user defined stucture as application
variable.
> > just of the sake of example
> > public struct student
> > {
> > int id;
> > string name;
> > float age;
> > string address1;
> > string address2;
> > }
> > How can I create an object of student type as an application variable?
> > "James Doran" <jamied1@.NO_SPAMbreathe.com> wrote in message
> > news:e4qMukrUEHA.2520@.TK2MSFTNGP10.phx.gbl...
> > > Muhammad,
> > > > You could store this structure in the Application object, and update
it
> > > there. Although you may have threading issues, so use locking when
> > > accessing it.
> > > > James
> > > > "Muhammad Sheikh" <Muhammad.Sheikh@.4mat.com> wrote in message
> > > news:eFIQYgrUEHA.2388@.TK2MSFTNGP09.phx.gbl...
> > > > sorry didn't make myself clear, I want to use a data structure and
> > assign
> > > > values to its members on different pages and offcourse want to
retain
> > all
> > > > values assigned on different pages.
> > > > > > "Phil Winstanley [Microsoft MVP ASP.NET]" <phil@.winstanley.name>
wrote
> > in
> > > > message news:camdst$oni@.odak26.prod.google.com...
> > > > > Muhammad,
> > > > > > > > I assume you mean the Visual style of the pages?
> > > > > > > > There are a few ways this can be done, I personally use
> > > > > WilsonMasterPages: -
> > > > > > > > http://authors.aspalliance.com/Paul...Articles/?id=14
> > > > > > > > Hth,
> > > > > Phil Winstanley
> > > > > Microsoft ASP.NET MVP
> > > > > http://www.myservicescentral.com
> > > > > > > > >
there is no need to use the application collection. you can just declare a
static version of your struct.

class myGlobal
{
static public struct student = initStudent();
}

you will need to sync access to members

-- bruce (sqlwork.com)

"James Doran" <jamied1@.NO_SPAMbreathe.com> wrote in message
news:u2jIuzrUEHA.1036@.TK2MSFTNGP12.phx.gbl...
> Define the struct as you have in a file within your project. In the
> Application_Start event handler in the Global.asax file of your project,
> enter the following code:
> VB:
> Dim oStudent As SomeNamespace.student
> ' Initialise
> oStudent.ID = 0
> oStudent.Age = 15
> ...
> ' Add the student to the application object
> Application("Student") = oStudent
> C#:
> SomeNamespace.student oStudent;
> // Initialise
> oStudent.ID = 0;
> oStudent.Age = 15;
> ...
> // Add the student to the application object
> Application["Student"] = oStudent;
> The student struct will then be available to each page. To access it, use
> the following code:
> VB:
> CType(Application("Student"), SomeNamespace.student) ...
> C#:
> (SomeNamespace.student)Application["Student"] ...
> Hope this helps,
> James
> "Muhammad Sheikh" <Muhammad.Sheikh@.4mat.com> wrote in message
> news:uTCmXtrUEHA.2972@.TK2MSFTNGP12.phx.gbl...
> > Is it possible to definte a user defined stucture as application
variable.
> > just of the sake of example
> > public struct student
> > {
> > int id;
> > string name;
> > float age;
> > string address1;
> > string address2;
> > }
> > How can I create an object of student type as an application variable?
> > "James Doran" <jamied1@.NO_SPAMbreathe.com> wrote in message
> > news:e4qMukrUEHA.2520@.TK2MSFTNGP10.phx.gbl...
> > > Muhammad,
> > > > You could store this structure in the Application object, and update
it
> > > there. Although you may have threading issues, so use locking when
> > > accessing it.
> > > > James
> > > > "Muhammad Sheikh" <Muhammad.Sheikh@.4mat.com> wrote in message
> > > news:eFIQYgrUEHA.2388@.TK2MSFTNGP09.phx.gbl...
> > > > sorry didn't make myself clear, I want to use a data structure and
> > assign
> > > > values to its members on different pages and offcourse want to
retain
> > all
> > > > values assigned on different pages.
> > > > > > "Phil Winstanley [Microsoft MVP ASP.NET]" <phil@.winstanley.name>
wrote
> > in
> > > > message news:camdst$oni@.odak26.prod.google.com...
> > > > > Muhammad,
> > > > > > > > I assume you mean the Visual style of the pages?
> > > > > > > > There are a few ways this can be done, I personally use
> > > > > WilsonMasterPages: -
> > > > > > > > http://authors.aspalliance.com/Paul...Articles/?id=14
> > > > > > > > Hth,
> > > > > Phil Winstanley
> > > > > Microsoft ASP.NET MVP
> > > > > http://www.myservicescentral.com
> > > > > > > > >

Structure of a 3-tier application

Hi to all. I'm new using Visual Web Developer and I'm just getting familiar with the folder structure in projects (App_Data, App_Code, etc.).

In previous versions of Visual Studio you create a Solution and then you could add projects into it...so, a three tier app would be composed of 1 solution, and 3 projects (Business, Data, UI).

With this new approach, what would be the right structure (folders, etc.) of the application project for a 3-tier app!!??

Thanks in advance!!Visit the following: http://www.15seconds.com/issue/050721.htm

Hope this helps!
Wow, that's great!!

Thanks eccsolutions for your help!!! Just what I was looking for!

Tuesday, March 13, 2012

Stuck on XML/XSLT with Asp.net 1.1 server controls.

Hello everyone,

I am working on a custom built portal system in Visual Studio 2003 and I amstuck on how to develop with XML/XSLT and using Asp.net server controls. Theportal consists of "applications" (each application is essentially a.aspx page) and those applications consists of "modules" (whichderives from UserControl). Now in order to maintain a consistent look for allmodules/applications and to minimize the amount of actual html hard coded, Iwant to use XSLT (which would contain the html) and CSS to help generate thatconsistent appearance. TheModule class containstitle andbodyfields, wherebodycan have any form of content (html/text/javascript),but sinceModulederives from UserControl, it can also contain .Net childcontrols, and I need those child controls to render correctly to take fulladvantage of Asp.Net. What would be the best approach to accomplish this inwhich the module would be transformed using a XSL file?


This also needs to apply to an application as well (or atleast the layout of the application, something that controls the placement ofthe modules). If I have a collection of modules, I need to put them in someform of structure or layout and transform that layout through an XSL file tohave a consistent look and only one place to look when we need to change thelook of a module or application. What would be the best approach for this orcould you point me in the right direction? If you need any furtherclarification, I would be more than willing to help. Thanks in advance!

Steve

Wow that was a lot...

Was there a specific bit of coding that you are stuck on or are you looking for a broadranged theory?


If you'd like I can tell you what I have right now, but I'mthinking it may be better to take a step back and look at it from a differentangle.Smile [:)] The first question is best approach to take a user control that contains child controls and other content, run it through an .xsl file, and have it display properly on the page. Thanks for your help!


User controls containing child controls is nothing special... in fact really just about every User Control ever made has child controls. User Controls, with User Controls would be nothing different really either...

Let me see if I have it right, before I comment...

You want your XML to contain the list of what's on each control, and the XSL to contain the "way" that the controls display? Is that correct?

And you are wondering if this is a good approach?