Monday, March 12, 2012

Why this code line doenst work?

Hello,

I have the following code in the Global.asax:

Sub Session_Start(Sender As Object, E As EventArgs)
Thread.CurrentThread.CurrentCulture = New CultureInfo("en-US")
End Sub

The Error I get: "Name 'Thread' is not declared."

However when I have this in my aspx code it works:

Sub Page_Load(Sender As Object, E As EventArgs)
Thread.CurrentThread.CurrentCulture = New CultureInfo("pt-PT")
End Sub

Why?
Can't I set the culture in the Global.asax?

Thank You,
MiguelHi, Shapper.

Please review these links :

http://www.codingforums.com/archive/index.php/t-10203

http://www.tek-tips.com/faqs.cfm?fid=2707

http://www.eggheadcafe.com/ng/micro...ost20240872.asp

Juan T. Llibre
ASP.NET MVP
http://asp.net.do/foros/
Foros de ASP.NET en Espaol
Ven, y hablemos de ASP.NET...
======================

"Shapper" <mdmoura*NOSPAM*@.gmail.*DELETE2SEND*com> wrote in message
news:u9OpMQLTFHA.3952@.TK2MSFTNGP15.phx.gbl...
> Hello,
> I have the following code in the Global.asax:
> Sub Session_Start(Sender As Object, E As EventArgs)
> Thread.CurrentThread.CurrentCulture = New CultureInfo("en-US")
> End Sub
> The Error I get: "Name 'Thread' is not declared."
> However when I have this in my aspx code it works:
> Sub Page_Load(Sender As Object, E As EventArgs)
> Thread.CurrentThread.CurrentCulture = New CultureInfo("pt-PT")
> End Sub
> Why?
> Can't I set the culture in the Global.asax?
> Thank You,
> Miguel
"Shapper" <mdmoura*NOSPAM*@.gmail.*DELETE2SEND*com> wrote in message
news:u9OpMQLTFHA.3952@.TK2MSFTNGP15.phx.gbl...
> Hello,
> I have the following code in the Global.asax:
> Sub Session_Start(Sender As Object, E As EventArgs)
> Thread.CurrentThread.CurrentCulture = New CultureInfo("en-US")
> End Sub
> The Error I get: "Name 'Thread' is not declared."
> However when I have this in my aspx code it works:
> Sub Page_Load(Sender As Object, E As EventArgs)
> Thread.CurrentThread.CurrentCulture = New CultureInfo("pt-PT")
> End Sub
> Why?
> Can't I set the culture in the Global.asax?
> Thank You,
> Miguel
Did you Import the System.Threading class? Or use the full name,
System.Threading.Thread.

--

Joe (MVP)

https://mvp.support.microsoft.com/p...E8-8741D22D17A5
My first guess would be that you are missing the namespace of this "Thread"
class or use the complete namespace reference while using "Thread"

Thread class is in System.Threading

"Shapper" wrote:

> Hello,
> I have the following code in the Global.asax:
> Sub Session_Start(Sender As Object, E As EventArgs)
> Thread.CurrentThread.CurrentCulture = New CultureInfo("en-US")
> End Sub
> The Error I get: "Name 'Thread' is not declared."
> However when I have this in my aspx code it works:
> Sub Page_Load(Sender As Object, E As EventArgs)
> Thread.CurrentThread.CurrentCulture = New CultureInfo("pt-PT")
> End Sub
> Why?
> Can't I set the culture in the Global.asax?
> Thank You,
> Miguel
>
Ah,

I just found out. I forgot the dam line in Global.asax:
<%@. import Namespace="System.Threading" %
I had it on my ASPX page. I didn't even notice.

Sorry for the time.

Thanks,
Miguel

"Diffident" <Diffident@.discussions.microsoft.com> wrote in message
news:Diffident@.discussions.microsoft.com:

> My first guess would be that you are missing the namespace of this "Thread"
> class or use the complete namespace reference while using "Thread"
> Thread class is in System.Threading
> "Shapper" wrote:
>
> > Hello,
> > I have the following code in the Global.asax:
> > Sub Session_Start(Sender As Object, E As EventArgs)
> > Thread.CurrentThread.CurrentCulture = New CultureInfo("en-US")
> > End Sub
> > The Error I get: "Name 'Thread' is not declared."
> > However when I have this in my aspx code it works:
> > Sub Page_Load(Sender As Object, E As EventArgs)
> > Thread.CurrentThread.CurrentCulture = New CultureInfo("pt-PT")
> > End Sub
> > Why?
> > Can't I set the culture in the Global.asax?
> > Thank You,
> > Miguel

Why this code line doenst work?

Hello,
I have the following code in the Global.asax:
Sub Session_Start(Sender As Object, E As EventArgs)
Thread.CurrentThread.CurrentCulture = New CultureInfo("en-US")
End Sub
The Error I get: "Name 'Thread' is not declared."
However when I have this in my aspx code it works:
Sub Page_Load(Sender As Object, E As EventArgs)
Thread.CurrentThread.CurrentCulture = New CultureInfo("pt-PT")
End Sub
Why?
Can't I set the culture in the Global.asax?
Thank You,
Miguel

Have you add

Imports System.Threading statement in your code


Of Course. I forgot the dam line.
Thanks,
Miguel

Why this error when table has this column name

I know my table has this column but I keep getting the following error doesn't make sense: (my code for the for the button is below the error)

Column 'CompanyID' does not belong to table Categories.

Description:An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details:System.ArgumentException: Column 'CompanyID' does not belong to table Categories.
Source Error:
Line 883: Dim row As DataRowLine 884: row = DsPerformanceTabStrip1.Categories.NewCategoriesRowLine 885: row("CompanyID") = Session("companyID")Line 886: row("FacilityID") = Session("facilityID")Line 887: row("PeriodID") = Session("Period")

PrivateSub btnCatAdd_Click(ByVal senderAs System.Object,ByVal eAs System.EventArgs)Handles btnCatAdd.Click

DsPerformanceTabStrip1.Clear()

SqlDataAdapter1.SelectCommand.Parameters("@dotnet.itags.org.Period").Value = ddlEvalPeriod.SelectedValue

SqlDataAdapter1.Fill(DsPerformanceTabStrip1)

Dim rowAs DataRow

row = DsPerformanceTabStrip1.Categories.NewCategoriesRow

row("CompanyID") = Session("companyID")

row("FacilityID") = Session("facilityID")

row("PeriodID") = Session("Period")

row("SeqNbr") = txtSeq.Text

row("Description") = txtDescription.Text

DsPerformanceTabStrip1.Categories.AddCategoriesRow(row)

SqlDataAdapter1.Update(DsPerformanceTabStrip1)

DsPerformanceTabStrip1.Clear()

SqlDataAdapter1.Fill(DsPerformanceTabStrip1)

dgCategoryCurrent.DataBind()

EndSub

I found my answer -- I wasn't calling these columns in my stored procedure--I had the wrong stored procedure in my dataadapter

Why this error message?

VB.NET / ASP.NET

I have a simple test. One simple Formview connected to a datasource. I
have Button1 outside of the Formview. The Formview starts in ReadOnlyMode.
All I want to do is on the button click, change the formview to Insert mode
and then put the current date in the date textbox. The date textbox ID is
DateTextBox and I've double check that to make sure it's right. Here's my
simple code.

Protected Sub Button1_Click1(ByVal sender As Object, ByVal e As
System.EventArgs)

FormView1.ChangeMode(FormViewMode.Insert)

Dim datetb As TextBox = FormView1.FindControl("DateTextBox")

datetb.Text = Now.Date.ToShortDateString()

End Sub

This is the error message I'm getting.

Object reference not set to an instance of an object.
Description: An unhandled exception occurred during the execution of the
current web request. Please review the stack trace for more information
about the error and where it originated in the code.

Exception Details: System.NullReferenceException: Object reference not set
to an instance of an object.

Source Error:

Line 6: FormView1.ChangeMode(FormViewMode.Insert)
Line 7: Dim datetb As TextBox =
FormView1.FindControl("DateTextBox")
Line 8: datetb.Text = Now.Date.ToShortDateString()
Line 9: End Sub
Line 10: </script>

Thanks in advance!
PhilOn Aug 12, 4:49 pm, "pvong" <phillip*at*yahoo*dot*comwrote:

Quote:

Originally Posted by

VB.NET / ASP.NET
>
I have a simple test. One simple Formview connected to a datasource. I
have Button1 outside of the Formview. The Formview starts in ReadOnlyMode.
All I want to do is on the button click, change the formview to Insert mode
and then put the current date in the date textbox. The date textbox ID is
DateTextBox and I've double check that to make sure it's right. Here's my
simple code.
>
Protected Sub Button1_Click1(ByVal sender As Object, ByVal e As
System.EventArgs)
>
FormView1.ChangeMode(FormViewMode.Insert)
>
Dim datetb As TextBox = FormView1.FindControl("DateTextBox")
>
datetb.Text = Now.Date.ToShortDateString()
>
End Sub
>
This is the error message I'm getting.
>
Object reference not set to an instance of an object.
Description: An unhandled exception occurred during the execution of the
current web request. Please review the stack trace for more information
about the error and where it originated in the code.
>
Exception Details: System.NullReferenceException: Object reference not set
to an instance of an object.
>
Source Error:
>
Line 6: FormView1.ChangeMode(FormViewMode.Insert)
Line 7: Dim datetb As TextBox =
FormView1.FindControl("DateTextBox")
Line 8: datetb.Text = Now.Date.ToShortDateString()
Line 9: End Sub
Line 10: </script>
>
Thanks in advance!
Phil


Hi Phil

Are there any entry in the datasource?
Yes, there are entries in the Datasource. If I manually put the date in, it
works perfectly. I just want when the user clicks this button for the
formview to auto switch to Insert mode and auto put in today's date for them
in the datetb.
Thanks!
Phil

"Alexey Smirnov" <alexey.smirnov@.gmail.comwrote in message
news:1186930820.570788.158710@.22g2000hsm.googlegro ups.com...

Quote:

Originally Posted by

On Aug 12, 4:49 pm, "pvong" <phillip*at*yahoo*dot*comwrote:

Quote:

Originally Posted by

>VB.NET / ASP.NET
>>
>I have a simple test. One simple Formview connected to a datasource. I
>have Button1 outside of the Formview. The Formview starts in
>ReadOnlyMode.
>All I want to do is on the button click, change the formview to Insert
>mode
>and then put the current date in the date textbox. The date textbox ID
>is
>DateTextBox and I've double check that to make sure it's right. Here's
>my
>simple code.
>>
>Protected Sub Button1_Click1(ByVal sender As Object, ByVal e As
>System.EventArgs)
>>
>FormView1.ChangeMode(FormViewMode.Insert)
>>
>Dim datetb As TextBox = FormView1.FindControl("DateTextBox")
>>
>datetb.Text = Now.Date.ToShortDateString()
>>
>End Sub
>>
>This is the error message I'm getting.
>>
>Object reference not set to an instance of an object.
>Description: An unhandled exception occurred during the execution of the
>current web request. Please review the stack trace for more information
>about the error and where it originated in the code.
>>
>Exception Details: System.NullReferenceException: Object reference not
>set
>to an instance of an object.
>>
>Source Error:
>>
>Line 6: FormView1.ChangeMode(FormViewMode.Insert)
>Line 7: Dim datetb As TextBox =
>FormView1.FindControl("DateTextBox")
>Line 8: datetb.Text = Now.Date.ToShortDateString()
>Line 9: End Sub
>Line 10: </script>
>>
>Thanks in advance!
>Phil


>
Hi Phil
>
Are there any entry in the datasource?
>

Why this error message?

VB.NET / ASP.NET
I have a simple test. One simple Formview connected to a datasource. I
have Button1 outside of the Formview. The Formview starts in ReadOnlyMode.
All I want to do is on the button click, change the formview to Insert mode
and then put the current date in the date textbox. The date textbox ID is
DateTextBox and I've double check that to make sure it's right. Here's my
simple code.
Protected Sub Button1_Click1(ByVal sender As Object, ByVal e As
System.EventArgs)
FormView1.ChangeMode(FormViewMode.Insert)
Dim datetb As TextBox = FormView1.FindControl("DateTextBox")
datetb.Text = Now.Date.ToShortDateString()
End Sub
This is the error message I'm getting.
Object reference not set to an instance of an object.
Description: An unhandled exception occurred during the execution of the
current web request. Please review the stack trace for more information
about the error and where it originated in the code.
Exception Details: System.NullReferenceException: Object reference not set
to an instance of an object.
Source Error:
Line 6: FormView1.ChangeMode(FormViewMode.Insert)
Line 7: Dim datetb As TextBox =
FormView1.FindControl("DateTextBox")
Line 8: datetb.Text = Now.Date.ToShortDateString()
Line 9: End Sub
Line 10: </script>
Thanks in advance!
PhilOn Aug 12, 4:49 pm, "pvong" <phillip*at*yahoo*dot*com> wrote:
> VB.NET / ASP.NET
> I have a simple test. One simple Formview connected to a datasource. I
> have Button1 outside of the Formview. The Formview starts in ReadOnlyMode
.
> All I want to do is on the button click, change the formview to Insert mod
e
> and then put the current date in the date textbox. The date textbox ID is
> DateTextBox and I've double check that to make sure it's right. Here's my
> simple code.
> Protected Sub Button1_Click1(ByVal sender As Object, ByVal e As
> System.EventArgs)
> FormView1.ChangeMode(FormViewMode.Insert)
> Dim datetb As TextBox = FormView1.FindControl("DateTextBox")
> datetb.Text = Now.Date.ToShortDateString()
> End Sub
> This is the error message I'm getting.
> Object reference not set to an instance of an object.
> Description: An unhandled exception occurred during the execution of the
> current web request. Please review the stack trace for more information
> about the error and where it originated in the code.
> Exception Details: System.NullReferenceException: Object reference not set
> to an instance of an object.
> Source Error:
> Line 6: FormView1.ChangeMode(FormViewMode.Insert)
> Line 7: Dim datetb As TextBox =
> FormView1.FindControl("DateTextBox")
> Line 8: datetb.Text = Now.Date.ToShortDateString()
> Line 9: End Sub
> Line 10: </script>
> Thanks in advance!
> Phil
Hi Phil
Are there any entry in the datasource?
Yes, there are entries in the Datasource. If I manually put the date in, it
works perfectly. I just want when the user clicks this button for the
formview to auto switch to Insert mode and auto put in today's date for them
in the datetb.
Thanks!
Phil
"Alexey Smirnov" <alexey.smirnov@.gmail.com> wrote in message
news:1186930820.570788.158710@.22g2000hsm.googlegroups.com...
> On Aug 12, 4:49 pm, "pvong" <phillip*at*yahoo*dot*com> wrote:
> Hi Phil
> Are there any entry in the datasource?
>

why this doesnt work

i new to asp.net, i have use the following code to bind the database to datagrid control.

<%@dotnet.itags.org. Page Language="VB" %>
<%@dotnet.itags.org. import Namespace="System.Data" %>
<%@dotnet.itags.org. import Namespace="System.Data.SqlClient" %>
<script runat="server"
' Insert page code here
'
Sub Page_Load(Sender As Object, E As EventArgs)
Dim DS As DataSet
Dim MyConnection As SqlConnection = New SqlConnection("server='(local)'; trusted_connection=true; database='model'")
Dim MyCommand As SqlCommand = New SqlCommand("SELECT * FROM jobs", myConnection)

DS = new DataSet()
MyCommand.Fill(ds, "jobs")

DataGrid1.DataSource=ds.Tables("jobs").DefaultView
DataGrid1.DataBind()
End Sub
End Sub
</script>
<html>
<head>
</head>
<body>
<form runat="server">
<p>
<asp:DataGrid id="DataGrid1" runat="server"></asp:DataGrid>
</p>
</form>
</body>
</html
AND i always get this error page which doesn't help a lots
Server Error in '/' 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: The compiler failed with error code 1.

Show Detailed Compiler Output:(nothing apear in here)

Show Complete Compilation Source:(same as here)Make sure that your web.config file is well formed. If you are using Visual Studio run the solution without debugging and you should see a detailed error message.

hope this helps,
sivilian

why this doesnt work?

<%@dotnet.itags.org. Page Language="C#" %
<span id="span1" runat="server">Test_String</span>
<br><br
<%
Response.Write (span1.ID); // works: span1
Response.Write ("<br>");
Response.Write (span1.InnerHtml); // works: Test_String
Response.Write ("<br>");

Response.Write (FindControl("span1").ID); // works: span1
Response.Write ("<br>");
Response.Write (FindControl("span1").InnerHtml); // doesn't work, why??
Response.Write ("<br>");
%Hi,

FindControl returns back something of type control so you have to cast it first to the correct type.

Grz, Kris.
thx XIII
but how? any hint?
Change:

 Response.Write (FindControl("span1").InnerHtml);
to:
 Response.Write (((HtmlGenericControl)FindControl("span1")).InnerHtml);
To make this a bit less cryptic, here's how it works.

First, we use FindControl to actually grab the control:

FindControl("span")
However, this will give us a Control. As your error states, Control does not have an InnerHtml property. So, we first cast from a Control to a HtmlGenericControl (which is what the <span> is):
(HtmlGenericControl)FindControl("span")
Now, we put brackets around this combination, to give us our resulting HtmlGenericControl object:
((HtmlGenericControl)FindControl("span"))
Now that we have an HtmlGenericControl object, we can specify its InnerHtml property:
((HtmlGenericControl)FindControl("span1")).InnerHtml

I hope this helps.
hi, SomeNewKid,

thanks for yr help.
I tried yr way, but still not work :(
can you run this program ok in your machine?
> can you run this program ok in your machine?

Yes. With that single line change, your sample runs fine. Remember that C# is case-sensitive ... so you must type it exactly as shown.

When you say it still doesn't work, what exactly do you mean?

Do you get an error? If so, what does the error say?

Do you get an output that you did not expect? If so, what output were you expecting?
thanks to SomeNewKid, I got it! it runs ok now.

here is another probem, I added two 'Reponse' lines, first & second run ok, but the third line got a error. Is this 'HtmlGenericControl' not for a 'TD' tag?


<%@. Page Language="C#" %
<span id="id_span" runat="server">span_string</span>
<div id="id_div" runat="server">div_string</div
<form id="form1" runat="server">
<table id="table1" border="1" runat="server">
<tr id="id_tr" runat="server">
<td id="id_td" runat="server">td_string</td>
</tr>
</table>
</form
<%
Response.Write (((HtmlGenericControl)FindControl("id_span")).InnerHtml); // ok
Response.Write (((HtmlGenericControl)FindControl("id_div")).InnerHtml); //ok
Response.Write (((HtmlGenericControl)FindControl("id_td")).InnerHtml); // got error!
%>

> Is this 'HtmlGenericControl' not for a 'TD' tag?

Correct.

Here's a loose description of why:

The HtmlGenericControl is used for any control that is not "special" to ASP.NET.

A <span> tag is nothing special. It is just a tag sitting by itself, with no required parent or child tags. So, it's just a HtmlGenericControl.

A <td> tag, on the other hand, is not a tag sitting by itself. It must have a parent <tr> tag, and a grandparent <table> tag. This required structure makes tables "special" to ASP.NET. So, a <table> is an HtmlTable control, a <tr> is an HtmlTableRow control, and a <td> is a HtmlTableCell control.

Hence, you can get your code working by changing:

 Response.Write (((HtmlGenericControl)FindControl("id_td")).InnerHtml);
to:
 Response.Write (((HtmlTableCell)FindControl("id_td")).InnerHtml);
So, how on earth can you know which tags are generic, and which are special?

As always, the answer is in the documentation:
System.Web.UI.HtmlControls Namespace
oh, SomeNewKid! You are a good teacher! I love you so mucn~~~~
I think now I understood a lot about it, thank you very much!

p.s.
and I found 'HtmlContainerControl' can get work too :)
You're welcome.

why this error?Invalid attempt to read when no data is present

System.InvalidOperationException: Invalid attempt to read when no data is present. at System.Data.SqlClient.SqlDataReader.PrepareRecord(Int32 i) at System.Data.SqlClient.SqlDataReader.GetValue(Int32 i) at System.Data.SqlClient.SqlDataReader.get_Item(String name) at e_auction.temp.Page_Load(Object sender, EventArgs e)

I have check the query in QUERY ANALYZER, it worked pretty fine, but when i copy pasted, it is generating exception, I checked it, the part which is inbold is genearting exception and goes to catch part. i don't know y, help me plz


Dim bool_bidUpdate As Boolean = True
Dim lastBidder As Integer = 1
Dim inc As Long = 5000
Dim lastBid As Long = 175000

Dim tempMax As Long = 0
Dim tempBidder As Integer
Dim tempBidDate As Date
Dim tempCurrentBid As Long

Dim myConnection As SqlConnection = New SqlConnection(ConfigurationSettings.AppSettings("ConnectionString"))
Dim MydataReader As SqlDataReader
Dim MyCommand As New SqlCommand()

MyCommand = New SqlCommand("select * from temp1 where auctionId = 7 and maxBid > (select max(currBid) from temp1 where auctionId=7) order by maxBid DESC", myConnection)
myConnection.Open()
Try
MydataReader = MyCommand.ExecuteReader()
If CInt(MydataReader.Item("uId")) = lastBidder Then
bool_bidUpdate = False
Else
Do While MydataReader.Read()

If tempMax < MydataReader("maxBid") Then
If (MydataReader("maxBid") / (lastBid + inc)) >= 1 Then
tempMax = MydataReader("maxBid")
tempBidder = MydataReader("uId")
tempBidDate = MydataReader("bidDate")
tempCurrentBid = (lastBid + inc)
End If
ElseIf tempMax = MydataReader("maxBid") Then
If tempBidDate > MydataReader("bidDate") Then
tempBidDate = MydataReader("bidDate")
tempMax = MydataReader("maxBid")
tempBidder = MydataReader("uId")
End If
Else
Exit Do
End If

Loop
End If
myConnection.Close()

Catch b As Exception
Response.Write(b.ToString)
End Try
If bool_bidUpdate = False Then
Response.Write("no need to update")
Else
Response.Write("paleeeeez update" & " with uID: " & tempBidder & " with tempCurrentBid : " & tempCurrentBid)
End If

You need to call reader's Read method at least once before trying to access its data.
then wat should i do, if i start it from the first if condition my whole logic ruins, coz reader only goes in forward direction, so wat shoud i do, one way ard could be i check if this loop is executing second time the first if condition shouldn't be executing but this is just hmm not a good approach?
wat do u suggest.

'Read the first row
If reader.Read() Then
'Do the one-time check here

'Continue normally in the loop
Do
'processing goes here
'...
Loop While reader.Read()
Else
'No records
'...
End If
reader.Close()

Here is a way to check if there is a row/make a one time check and then continue normally.
it works fine as long as i don't use debugger, but whenever i inser any breakpoint, it gives me same error and goes to catch part. wat can be the prob
Where do you put breakpoints? What's the code you use now?
it generates error when it reaches to myDataReader part. i have put break point in various position sto check the prob, it still exists, wither its in some expression or either its some pace where i m using myDataReader. but when i run it without breakpoints it runs quite smooth.
i have changed the code to previous version, sorry for dat :)


Try
MydataReader = MyCommand.ExecuteReader()
Do While MydataReader.Read
-->breakPoint iLoopcheck = iLoopcheck + 1
If MydataReader.Item("uId") = lastBidder And iLoopcheck = 1 Then
tempLastMaxBid = MydataReader.Item("maxBid")
tempLastMaxBidder = MydataReader.Item("uId")
bool_lastCheck = False
Else
newCurrentBid = lastBid + inc
-->exception Point If tempMax < MydataReader("maxBid") Then
If (MydataReader("maxBid") / newCurrentBid) >= 1 Then

Why this Error

I am using VS 2003 and I have all my functions implemented however I still keeo getting the following error;

Method not found: Boolean ControleFone.Banco.Bd_Estoque.UpdateSaidaEstoque(Int32, Int32, System.DateTime, System.String, System.String, System.String).

I have this method implemented in my program so why do I keep getting this error!!!!

If you get the error message during compilation, it could be one of two things:

1. You have not properly referenced the Namespace if it's different from your project.
2. You are using the wrong parameter type compared to the method you have defined (meaning, the signatures are different).

why this is not valid?

When i read on MS press, it provide example like this, but when i try it on visual studio 2005, it show the % is invalid character. Anyone can comment about this? Thanks in advance.

<% Dim I As Integer
For I = 0 to 7 %>
<font size="<%=I%>"> Welcome to ASP.NET </font> <br/>
<% Next %>

Hi, where did you put it? I created a Visual Basic 'ASP.NET Web Site', and added the code to Default.aspx as following and it worked fine:

<%@. Page Language="VB" AutoEventWireup="false" CodeFile="Default.aspx.vb" Inherits="_Default" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Untitled Page</title>
</head>

<body>
<form id="form1" runat="server">
<div>
<% Dim I As Integer
For I = 0 to 7 %>
<font size="<%=I%>"> Welcome to ASP.NET </font> <br/>
<% Next %>
</div>
</form>

</body>
</html>


Hi, thanks for reply. I put it below pageload. After i read yr post, i paste under <body>, it also show error msg for dim, next and font. For dim, it said expression needed, while under next, it said a not declared, for font it said "validation (XHTML1.0 Transitional), element font is considered outdated, a new construct is recommended.

Why this happen? Thank you.

this is the code

<

div> <asp:LabelID="msg"runat="server"Height="48px"Style="z-index: 100; left: 48px;

position: absolute; top: 26px"

Width="119px"></asp:Label>

<%

#Dim aAsIntegerFor a = 0To 7%><fontsize="<%=a%>"> Welcome to ASP.NET</font><br/>

<%

Next %></div></form>
hi, it's ok already, just leave the font but the application can run. But i have a question, font is outdated?

Yes the font element is outdated. Please see my post in the FAQ about deprecated items:

http://forums.asp.net/thread/1291684.aspx


OK, but which of these:

· color

· font-family

· font-size

· text-decoration

· text-align

· text-indent

· text-transform

· font-weight

Replaces:

<Font class="mytestformat">


For an ASP Sever Control it is typically the CssClass property
<asp:Label CssClass="mytestformat">
Or for an html object it is just in it's class
<div class="mytestformat">...</div>
Putting a class attribute in a font element is actually counter intuitive since the font element is meant to control fonts (size, color, etc.) but css classes can do far far more.

why this works in query analyzer but not in code

I have this store procedure and I call it in the code and it returns nothing but when ran in QA it brings back all 4 employees. However it should only bring back two since two of the employees EmployeeID #'s are in the EmployeeEval table. Any ideas please -- I'm lost.
CREATE PROCEDURE dbo.sp_Employee_GetEmployeeLNameFNameEmpID
(
@dotnet.itags.org.facilityID nvarchar(2),
@dotnet.itags.org.companyID nvarchar(2),
@dotnet.itags.org.deptID nvarchar(20),
@dotnet.itags.org.Period int
)
AS
SELECT DISTINCT e.LastName + ',' + e.FirstName + ' - ' + e.EmployeeID AS ListBoxText, e.EmployeeID, e.LastName + ',' + e.FirstName AS FullName FROM Employee e LEFT JOIN EmployeeEval ev
ON e.CompanyID = ev.CompanyID AND e.FacilityID = ev.FacilityID
WHERE e.DeptID = @dotnet.itags.org.deptID AND e.FacilityID = @dotnet.itags.org.facilityID AND e.CompanyID = @dotnet.itags.org.companyID AND ev.PeriodID = @dotnet.itags.org.Period AND e.EmployeeID <> ev.EmployeeID
GOGot it to work here is my new SP in case anyone is interested.
CREATE PROCEDURE dbo.sp_Employee_GetEmployeeLNameFNameEmpID
(
@.facilityID nvarchar(2),
@.companyID nvarchar(2),
@.deptID nvarchar(20),
@.Period int
)
AS
SELECT e.LastName + ',' + e.FirstName + ' - ' + e.EmployeeID AS ListBoxText, e.EmployeeID, e.LastName + ',' + e.FirstName AS FullName FROM Employee e
WHERE e.DeptID = @.deptID AND e.FacilityID = @.facilityID AND e.CompanyID = @.companyID AND e.EmployeeID NOT IN (SELECT ev.EmployeeID FROM EmployeeEval ev
WHERE PeriodID= @. Period )
GO

I got my stored procedure working but now it won't bind anything to the ListBox even though QA is showing two results. Any ideas? Here is my code:

SqlConnection1.Open()

SqlCommand3.Parameters.Add(New SqlParameter("@.deptID", Session("deptID")))

SqlCommand3.Parameters.Add(New SqlParameter("@.Period", Session("Period")))

SqlCommand3.Parameters.Add(New SqlParameter("@.companyID", Session("companyID")))

SqlCommand3.Parameters.Add(New SqlParameter("@.facilityID", Session("facilityID")))

lbxEmployeeList.DataSource = SqlCommand3.ExecuteReader

lbxEmployeeList.DataTextField = "ListBoxText"

lbxEmployeeList.DataValueField = "EmployeeID"

lbxEmployeeList.DataBind()

SqlConnection1.Close()


Onewisehobbit,

First thing I would look at is to see if your session varables have been populated.

Regards

Chomps


I was thinking to complex -- thanks.

why throw the exception?

i've got a try/catch block that basically goes something like this...

try
{
// try to do something that may not work...
}
catch (Exception error)
{
// take the exception and put the info into a database so i can fix it later...
string strMyError = Convert.ToString(error);

//...
}

now, the book i'm using says to add thethrow keyword at the end of the catch block, but it doesn't really explain why...

my code works either way, what really happens when you throw at the end of a catch block? if you could, please be specific with details, i'd really like to understand this, and this book (ironically, a book written to study for the MCAD exams) doesn't even explain what it does...


//...
catch (Exception error)
{
//...
throw; // why?
}
hi...
i duno why ur book said so..if i ever wanna throw an exception in catch is to define my own exception for example i have an SQL exception thow to me then i catch it..in my catch block i wanted to thow another exception say my very own exception and customise my very own message handling so that when it display to the user is rather readable and at the same time i can also add more custome message like my Sql statement or what so ever message.

eg

catch(Exception err)
{
thow new MyCustomException(err,CodeID,"SELECT * from SQL",Friendly User message);
}

i duno if i had answer ur stuff but that is what i do...
Well,

You might want to take compensatory action - or some exception specific action at least in the individual 'low level' handler for a class.
Then you may want to throw the exception to a higher level handler - say at the Application layer to provide, for instance, more general exception reporting to the user.

Re-throwing an exception effectively bubbles up the exception to the next layer.

HTH
Throw returns info about the exception. For example you can define a number of different exceptions in your code and throw(return) information about the specific exception to the debugger or the application.
FromRich Custom Error Handling with ASP.NET:

"Before going on, note that there is a school of thought that says you should always throw an exception higher, that "swallowing" the exception is a bad idea. The reasoning is that exceptions should be visible and logged so that they can be guarded against in the future (with improved infrastructure, scalability, and so on), and that any instances that might be swallowed could be avoided with better programming. This happens to be true. Swallowing an exception is fine while debugging, but production code should always throw exceptions higher. Then, whenever preventable exceptions show up in the logs, you can apply some validation to ensure they won't happen again."
Well put SNK2.

It may be overkill, but we write to the servers application event log from our Try Catch as well as a secondary method using the Global.asax.vb Application_Error event that sends an email to the entire IT Dept with all the information related to the error as well as who was using it when the error occured. Being able to interface with the user as to what they were doing when the error occured can lead to a faster solution, unless of course it something obvious.

When one of my guys deploys a piece of code and it starts bombing out and everyones mailbox starts getting flooded with emails, it creates a sense of urgency because it makes you look bad to the other developers and youwill get heckled. We all have had small things pop up that requires a "geeezzz, I can't believe I did that! I'm really not that stupid guys, I swear!!!" Great laughs, but it's very affective in managing and preventing errors.

Why to upgrade to MS .Net Frame Work ?

I am asked to speak for about 3 hours on the above topic. I am looking for some ready to use Powerpoint / Presentation.

Does any body has idea, where do I find it ? (I believe, MS surely, would have made it available for public ;) )http://www.asp.net/whitepaper/whyaspnet.aspx?tabindex=0&tabid=1
http://www.microsoft.com/services/net/default.asp
Thanks adec,

The second link given by you, is more useful, since I am looking for more generic topic of .Net (not specific to ASP.NET).

Any idea, about .ppt or some ready to use Presentations ;)

Thanks once again.
Have you tried Google?
Yes, I had tried earlier, as well recently, but it come out with nonsenese informations.

I basically, expect compact information (preferably a .ppt) which broadly covers the basic concept of .Net and inspires the developers (and software companies) to move from Windows (and in half the cases, DOS :( ) to .Net

I am to speak to an Audience for converting them to .Net
You seem like a lazy bugger... ;) A Google search using "why .Net" + ".ppt" gave 207 hits, and at least some of them can be used as a foundation for your "speech".
hmmmm,

But you will agree, the right kind of "Search" needs to be "fired", may be, I am novice at that :( .

(But tell me, when I have knowledgable well wishers like you, why should I doodle (fumble) at google ? ;) )
I'll be glad to do your work for you. My going rate is USD 150 per hour, payable in advance.
Thanks,

The first person, whom I will contact for thepaid consultation will, surely be you (and for thefree friendly advice too ;) ).
What is the problem?

Power point is one of the easiest things int he world to put together, surely if you knew anything at all about .NET and your audience and you spent half as much time and energy doing those slides as you have talking about it in here you could've been done by now.
Do your own research and your own work.

That way you can actually have an understanding of what you're talking about, rather than just reading someone elses presentation.

There is so much on this topic and heaps available from MS itself.
I am anyway going to compile my own presentation from all these .ppt, .doc, .htm or .chm files which I will gather.

I just wanted to make sure, that I am not missing any vital points, since, it is going to be crucial descision for the participant to upgrade to .Net :) .
For you to state here: "it is going to be crucial descision for the participant to upgrade to .Net " How do you know that? If you really know that then your whole presentation should focus on that.

It sounds to me like it's not very important or they would've picked someone more knowledgable to present.
::inspires the developers (and software companies) to move from Windows (and in half the cases, DOS) to .Net

You are aware that .NET is not an operating system...aren't you?

why to use xmldocument and xmltextReader together?

Hello I saw an example at: http://www.c-sharpcorner.com/UploadFile/mahesh/ReadWriteXMLTutMellli2111282005041517AM/ReadWriteXMLTutMellli21.aspx

XmlDocument doc =new XmlDocument();
//Load the the document with the last book node.
XmlTextReader reader =new XmlTextReader("c:\\books.xml");
reader.Read();
// load reader
doc.Load(reader);

I just don't get it why do we need to use theXMLDocument and XmlTextReader togetherlike that. I thought the main purpose of using XMLTextReader is that it is more efficient then XMLDocument.

Kindly advice.

Its a tossup? The XMLDocument is more flexable then the XMLTextReader, but the XMLTextReader is much faster when its coming to reading.

Checkout this blog that I found. Good Reading:

http://ryangregg.com/PermaLink,guid,8464b4b2-b07f-41fa-972f-c8d535027875.aspx


everybody provides a difference between XMLdocument and xmltextreader, and I understand that we should try to use xmltextreader where ever possible.

but what about xpathdocument, where does this fall as compared to xmldocument and xmltextreader.

thanks

why to use GUID

Hi,
the links provided to me in microsoft doesn't help me much,,
can any one pls let me know , why to use GUID in .NET framework, how does it work and what is the necessity of declaring GUID.
Thanks,,

You may want to use a GUID if you are planning, for example, to register your .NET assembly as COM.

GUIDs are used in applications that transfer data between different system and/or databases. In this situation it is impractical to determine whether a particular ID exists in any of the connected systems. You should only use GUIDs in this type of situation.
The GUID itself is, essentially, a very large hexadecimal number, which is randomly generated. That fact that it is so large means that it is extremely unlikely that it would be duplicating an existing ID.


chandras17 wrote:

can any one pls let me know , why to use GUID in .NET framework, how does it work and what is the necessity of declaring GUID.


I had to use it in a former intranet application because I had to deal with Documentum. Also, sites that offer protected content tend to use guids because you can't really guess the next article (if it would be just like ...?articleid=13 then you could guess the next article would be 14).
On the other hand I heard one of our database specialists say that he discourages using guids as a primary key because they take up too much place. Just a thought.
Grz, Kris.
A GUID is just what it sounds like. A unique identifier that's globallyunque. Thus, if you need some type of unique identifier (say, a primarykey in a database) that must be unique not only locally (that table)but globally (across virtually time and space), you use a GUID. Thatway you dont run into problems such as combining two tables withprimary keys being integer identify fields. Each table will have a PKof 1,2,3, etc. Not so with GUIDs.
GUIDs also work for creating single-use keys. Say a credit card companywants to create single-use credit card numbers for card holders to useon the internet. The card user goes to their site, generates a GUID,and uses that to buy something. When the retailer submits the GUID tothe credit card company, the CC company validates the GUID back to thecardholder's account and then marks the GUID as "used" so it can neverbe used again -- thus prevening fraud.

why to use constructors

what is the advantage to use a constructor and passing arguments to it rather than using the functions and sub arguments??You need less operations targeted for the object you set arguments for.

For example if you create object that takes five arguments. You could instantiate the object and set all five arguments at once or you could create the object and call 5 different methods (or you would use properties actually), that makes 6 operations when with instantiation it is only one.

Certainly the picture isn't that black and white always for example only certain values could be set when object is constructed and only certain via propeeties (requirements by the business logic).

Why tracing is needed?

Why tracing is needed?Tracing is helpful (if not needed) when you want to determine what is taking time for the operation to run. What exactly is your current problem?
Tracing isn't needed. It's simply there to help you see what is going on when a page gets rendered, often as an aid to debugging.

Why twin taskbar icons?

I am running Visual Web Developer.

Why are there two taskbar icons whose hint/tooltip = "ASP.NET Development Server - Port [2830,1377]?

Because each web project in your solution starts its own webdev server when you "run" the solution.

Hope it helps,

Klaus


but I only have one project open, and I haven't even run it today--it's simply been open in the IDE...

Why use 2 SQLDataSource

Im following a guide.....The autor uses SQLDataSource1 to display data in a gridview (lets say an artist and his album) then he creates SqlDataSource2 to bound to a drop down list which only lists the albums by an artist. Auto post back is enabled so whenever i click an artists name it only returns their albums.

My question is simply why use 2 SQLDatasource - when would you need to use 2 datasources?

Thanks

If you notice those datasources there, you will probably find that their select parameters are different. Your first datasource has probably no filter at all in it's select statement, but your second datasource has probably a filter by artist in its select statement. So, you do not want a filter to be used with the datagrid, but you need a filter to be used with the dropdown. Sice this "filter" is not set in the client controls (the datagridview and dropdown don't even know what a "filter" is), but in the datasources, you need two different datasources, one for each case you have.

Just try combining those two datasources, and see the mess you'll end up with lol.

Hope it helps,
Jorge


Thanks for that. It makes some sense. Yes your right he did have a filter on the second SQLSource but the first had none.

As a general rule when should you have 2 SqlDataSources? i.e. whenever you want to filter data?

Thanks


I would prefer to use the single SQLDataSource for the DDL and GridView with the following SQLStatement.

CREATE PROCEDURE dbo.usp_Album_Select
@.Artist Varchar(50)
AS{
SELECT * FROM Album WHERE Artist = COALESCE(@.Artist, Artist)
}


Hi EssCee,

Based on my understanding, you did a simple project following an article. And you want to know why and when use multiple SqlDataSource in one page. If I have misunderstood you, please feel free to let me know.

The SqlDataSource control enables you to use a Web control to access data sources. You can use the SqlDataSource control with other controls that display data, such as the GridView, FormView, and DetailsView controls, to display and manipulate data on an ASP.NET Web page, using little or no code. Generally, the control be used to display data has one DataSource Control. In your case, there are two controls be used to display different data. So there are two SqlDataSources. But sometimes multiple controls maybe have one dataSource Control; hence they have the same DataSource.

Sometimes, there are many data be selected from database. But you want to display the data you want to display. So you need to filter the data.

It is hard to say that why or when use DataSource Control and when you should filter data. You should work by your requirements.


I hope this helps.

Why use <%= %> ?

Hello,

Newbie alert, so please be patient <g
I ASP Classic, we were used to using tricks like ...

<%=strName%
to insert dynamic content into an HTML block. In ASP.NET, you have
various controls like the label that seem to do the same thing, but with
much more power and flexibility. If so, is there any reason to use <%=
%> at all?

I only ask as I am reading ASP.NET Unleashed, and he shows an example of
using this. I couldn't see why he didn't just use a control. Granted his
example was something like ...

<body bgcolor="<%=strColour%>"
where he was including an attribute for a tag, rather than a whole tag,
but he already mentioned a generic control that just produced the basic
text rather than a tag, so why not use that?

TIA

--
Alan Silver
(anything added below this line is nothing to do with me)Alan:
You are right, there's almost never a good reason to prefer <%= %> over
using controls. True <%= %> might be nanoseconds faster, but you pay the
price (about 10x over) with maintenance and bugs. Hopefully the book was
just showing that you COULD do it. There might be very odd occasions were
you want to. Someone recently asked how to create a <base> tag...at ifrst I
thought just use <base id="x" runat="server" /> and declare it as an
HtmlGenericControl...but it turns out <base> CAN'T have a closing tag, and
all server/html controls render a closing tag. I provided the guy with a
server control which overwrote the closing tag behaviour, but using <%= %>
might have been an easier solution for him to use...There have been other,
although I can probably count them on a single hand, occasions...

Karl

--
MY ASP.Net tutorials
http://www.openmymind.net/

"Alan Silver" <alan-silver@.nospam.thanx> wrote in message
news:gO$TmAKLtR9BFwjq@.nospamthankyou.spam...
> Hello,
> Newbie alert, so please be patient <g>
> I ASP Classic, we were used to using tricks like ...
> <%=strName%>
> to insert dynamic content into an HTML block. In ASP.NET, you have
> various controls like the label that seem to do the same thing, but with
> much more power and flexibility. If so, is there any reason to use <%=
> %> at all?
> I only ask as I am reading ASP.NET Unleashed, and he shows an example of
> using this. I couldn't see why he didn't just use a control. Granted his
> example was something like ...
> <body bgcolor="<%=strColour%>">
> where he was including an attribute for a tag, rather than a whole tag,
> but he already mentioned a generic control that just produced the basic
> text rather than a tag, so why not use that?
> TIA
> --
> Alan Silver
> (anything added below this line is nothing to do with me)
Good example. There is nothing in asp.net representing <body> tag, so use of
<%... is appropriate. You can replace <body> with a generic control (then
you will end up with two <body>). Also you might prefer keeping your old asp
style.

Eliyahu

"Alan Silver" <alan-silver@.nospam.thanx> wrote in message
news:gO$TmAKLtR9BFwjq@.nospamthankyou.spam...
> Hello,
> Newbie alert, so please be patient <g>
> I ASP Classic, we were used to using tricks like ...
> <%=strName%>
> to insert dynamic content into an HTML block. In ASP.NET, you have
> various controls like the label that seem to do the same thing, but with
> much more power and flexibility. If so, is there any reason to use <%=
> %> at all?
> I only ask as I am reading ASP.NET Unleashed, and he shows an example of
> using this. I couldn't see why he didn't just use a control. Granted his
> example was something like ...
> <body bgcolor="<%=strColour%>">
> where he was including an attribute for a tag, rather than a whole tag,
> but he already mentioned a generic control that just produced the basic
> text rather than a tag, so why not use that?
> TIA
> --
> Alan Silver
> (anything added below this line is nothing to do with me)
>Alan:
>You are right, there's almost never a good reason to prefer <%= %> over
>using controls. True <%= %> might be nanoseconds faster, but you pay the
>price (about 10x over) with maintenance and bugs. Hopefully the book was
>just showing that you COULD do it.

OK, I guessed it wasn't necessary (usually), but it's nice tohave it
confirmed.

> There might be very odd occasions were
>you want to. Someone recently asked how to create a <base> tag...at ifrst I
>thought just use <base id="x" runat="server" /> and declare it as an
>HtmlGenericControl...but it turns out <base> CAN'T have a closing tag, and
>all server/html controls render a closing tag. I provided the guy with a
>server control which overwrote the closing tag behaviour, but using <%= %>
>might have been an easier solution for him to use...There have been other,
>although I can probably count them on a single hand, occasions...

OK, forgive the ignorance as I'm *really* new at this, but I think I
read that one of the generic controls just produces pretty much what you
put in, which could be plain text. If I'm right, then can't you use that
instead? Or can't you use a control inside a tag? Just occurred to me as
I'm typing that this might not work.

Thanks

--
Alan Silver
(anything added below this line is nothing to do with me)
>Good example. There is nothing in asp.net representing <body> tag, so use of
><%... is appropriate. You can replace <body> with a generic control (then
>you will end up with two <body>). Also you might prefer keeping your old asp
>style.

I'm trying hard to learn ASP.NET as it is meant to be, not as a step
from ASP Classic ;-) I'm trying to get it right from the start, not keep
old ideas hanging over. Not easy ;-)

Thanks

>Eliyahu
>"Alan Silver" <alan-silver@.nospam.thanx> wrote in message
>news:gO$TmAKLtR9BFwjq@.nospamthankyou.spam...
>> Hello,
>>
>> Newbie alert, so please be patient <g>
>>
>> I ASP Classic, we were used to using tricks like ...
>>
>> <%=strName%>
>>
>> to insert dynamic content into an HTML block. In ASP.NET, you have
>> various controls like the label that seem to do the same thing, but with
>> much more power and flexibility. If so, is there any reason to use <%=
>> %> at all?
>>
>> I only ask as I am reading ASP.NET Unleashed, and he shows an example of
>> using this. I couldn't see why he didn't just use a control. Granted his
>> example was something like ...
>>
>> <body bgcolor="<%=strColour%>">
>>
>> where he was including an attribute for a tag, rather than a whole tag,
>> but he already mentioned a generic control that just produced the basic
>> text rather than a tag, so why not use that?
>>
>> TIA
>>
>> --
>> Alan Silver
>> (anything added below this line is nothing to do with me)

--
Alan Silver
(anything added below this line is nothing to do with me)
What, in the body tag, are you trying to set programmatically? There are
almost always more than 1 way to do things ;)

Mythran
There are controls which let you render text or even html inside a tag, but
I don't think there are any that let you define the attributes via
strings...even if they did, it would be the same as using <%= %> as you
wouldn't be able to program against it.

Karl

--
MY ASP.Net tutorials
http://www.openmymind.net/

"Alan Silver" <alan-silver@.nospam.thanx> wrote in message
news:VrrOvlSZRS9BFwXa@.nospamthankyou.spam...
> >Alan:
> >You are right, there's almost never a good reason to prefer <%= %> over
> >using controls. True <%= %> might be nanoseconds faster, but you pay the
> >price (about 10x over) with maintenance and bugs. Hopefully the book was
> >just showing that you COULD do it.
> OK, I guessed it wasn't necessary (usually), but it's nice tohave it
> confirmed.
> > There might be very odd occasions were
> >you want to. Someone recently asked how to create a <base> tag...at
ifrst I
> >thought just use <base id="x" runat="server" /> and declare it as an
> >HtmlGenericControl...but it turns out <base> CAN'T have a closing tag,
and
> >all server/html controls render a closing tag. I provided the guy with a
> >server control which overwrote the closing tag behaviour, but using <%=
%>
> >might have been an easier solution for him to use...There have been
other,
> >although I can probably count them on a single hand, occasions...
> OK, forgive the ignorance as I'm *really* new at this, but I think I
> read that one of the generic controls just produces pretty much what you
> put in, which could be plain text. If I'm right, then can't you use that
> instead? Or can't you use a control inside a tag? Just occurred to me as
> I'm typing that this might not work.
> Thanks
> --
> Alan Silver
> (anything added below this line is nothing to do with me)
>What, in the body tag, are you trying to set programmatically? There are
>almost always more than 1 way to do things ;)

The example I saw in the book was using <%=%> to set the bgcolor
attribute of the body tag. It was a simple example where you pick a
colour from a set of radio buttons, and the page is set to use that
colour when you post back.

--
Alan Silver
(anything added below this line is nothing to do with me)
>There are controls which let you render text or even html inside a tag, but
>I don't think there are any that let you define the attributes via
>strings...even if they did, it would be the same as using <%= %> as you
>wouldn't be able to program against it.

Why not? If you had a control that produced an attribute, you could
program against it. I can see that it would be the same as using <%=%>,
except that the code would be written in a more ASP.NET way, using
controls and setting them in the code block, rather than inserting code
in the HTML section, which is more of a Classic ASP approach.

--
Alan Silver
(anything added below this line is nothing to do with me)
Well, if you did:

myControl.AttributeString = "href='somevalue.html' target='_blank'"

you can't program against the href and target, in other words you couldn't
go

myControl.href = 'xxx' or
myControl.target = 'yyy'

they wouldn't be properties..just a string to render out..thankfully nothing
like that exists. You can always do control.Attributes.Add("href",
"blah.html") but that didn't solve the original problem of no closing
tag...

the code might not be in the HTML, but really you haven't solved the
uglyness, just moved it.

--
MY ASP.Net tutorials
http://www.openmymind.net/

"Alan Silver" <alan-silver@.nospam.thanx> wrote in message
news:Bsm7+iWtEU9BFwVJ@.nospamthankyou.spam...
> >There are controls which let you render text or even html inside a tag,
but
> >I don't think there are any that let you define the attributes via
> >strings...even if they did, it would be the same as using <%= %> as you
> >wouldn't be able to program against it.
> Why not? If you had a control that produced an attribute, you could
> program against it. I can see that it would be the same as using <%=%>,
> except that the code would be written in a more ASP.NET way, using
> controls and setting them in the code block, rather than inserting code
> in the HTML section, which is more of a Classic ASP approach.
> --
> Alan Silver
> (anything added below this line is nothing to do with me)
>Well, if you did:
>myControl.AttributeString = "href='somevalue.html' target='_blank'"
>you can't program against the href and target, in other words you couldn't
>go
>myControl.href = 'xxx' or
>myControl.target = 'yyy'
>they wouldn't be properties..just a string to render out..thankfully nothing
>like that exists. You can always do control.Attributes.Add("href",
>"blah.html") but that didn't solve the original problem of no closing
>tag...
>the code might not be in the HTML, but really you haven't solved the
>uglyness, just moved it.

OK, maybe I misunderstood. I thought you meant that if you had a control
that rendered attributes, you could do something like ...

<a href="http://links.10026.com/?link=<mycontrol id="fred">">hello</a
and then in code ...

mycontrol.fred = "http://www.blah.com"

but as I type it now, it just doesn't look right. I guess I see where
you are coming from. OK, so maybe there is a use for it!! Not so common,
but genuine.

Thanks for the reply

--
Alan Silver
(anything added below this line is nothing to do with me)
both approaches are possible and at times necessary.
In the case you cited, there is not an explicit control that represents the
BODY element in the document. everything before the FORM element is a
single Literal Control. So in that case, you have the options of either (1)
using an inline snippet or (2) doing a find/replace for "<body>"

Personally, I'd rather do the inline code.

"Alan Silver" <alan-silver@.nospam.thanx> wrote in message
news:gO$TmAKLtR9BFwjq@.nospamthankyou.spam...
> Hello,
> Newbie alert, so please be patient <g>
> I ASP Classic, we were used to using tricks like ...
> <%=strName%>
> to insert dynamic content into an HTML block. In ASP.NET, you have
> various controls like the label that seem to do the same thing, but with
> much more power and flexibility. If so, is there any reason to use <%=
> %> at all?
> I only ask as I am reading ASP.NET Unleashed, and he shows an example of
> using this. I couldn't see why he didn't just use a control. Granted his
> example was something like ...
> <body bgcolor="<%=strColour%>">
> where he was including an attribute for a tag, rather than a whole tag,
> but he already mentioned a generic control that just produced the basic
> text rather than a tag, so why not use that?
> TIA
> --
> Alan Silver
> (anything added below this line is nothing to do with me)
>both approaches are possible and at times necessary.
>In the case you cited, there is not an explicit control that represents the
>BODY element in the document. everything before the FORM element is a
>single Literal Control. So in that case, you have the options of either (1)
>using an inline snippet or (2) doing a find/replace for "<body>"
>Personally, I'd rather do the inline code.

Yup, sounds sensible to me. Thanks for the clarification. Being somewhat
new at this, I'm still working out what's what!!

>"Alan Silver" <alan-silver@.nospam.thanx> wrote in message
>news:gO$TmAKLtR9BFwjq@.nospamthankyou.spam...
>> Hello,
>>
>> Newbie alert, so please be patient <g>
>>
>> I ASP Classic, we were used to using tricks like ...
>>
>> <%=strName%>
>>
>> to insert dynamic content into an HTML block. In ASP.NET, you have
>> various controls like the label that seem to do the same thing, but with
>> much more power and flexibility. If so, is there any reason to use <%=
>> %> at all?
>>
>> I only ask as I am reading ASP.NET Unleashed, and he shows an example of
>> using this. I couldn't see why he didn't just use a control. Granted his
>> example was something like ...
>>
>> <body bgcolor="<%=strColour%>">
>>
>> where he was including an attribute for a tag, rather than a whole tag,
>> but he already mentioned a generic control that just produced the basic
>> text rather than a tag, so why not use that?
>>
>> TIA
>>
>> --
>> Alan Silver
>> (anything added below this line is nothing to do with me)

--
Alan Silver
(anything added below this line is nothing to do with me)

Why use Ajax All comments welcome

We are looking at Ajaxing our existing web application. Question is...Should
we Ajax any and everything we can, or not? One example...if a page posts bac
k
to itself, is that a good candidate for Ajax?On Nov 28, 10:52 pm, Wannabe <Wann...@.discussions.microsoft.com>
wrote:
> We are looking at Ajaxing our existing web application. Question is...Shou
ld
> we Ajax any and everything we can, or not? One example...if a page posts b
ack
> to itself, is that a good candidate for Ajax?
If it's posted back just to execute some server code and to update a
part of the page (for example just to show a message "record saved")
then it could be done using Ajax. The advantage of Ajax here would be
an update of piece of web page without reloading the entire page.
To be or not be is the question :-)
Maybe. I started playing around with it a while ago to see if it would be
useful or not and so far, I found it quite interesting. Not useful yet but
getting there. I haven't had the chance to look at all of the controls or
extenders yet but making my way there. I have found 1 control that could
prove extremely useful in saving postbacks when changing content on a
website. Its the accordion control. It can change the content of parts of
the site without postbacks. The update pannel is the same way. I have been
tempted to ajax up every possible place possible on my website, but hold
off. Guess I'm sort of conservative on that point (don't do it unless its
required). Part of this is company saying it has to be that way but...if it
were my choice?...
Either way, it looks like a good choice. If you use the accordion control,
watch out because it has a few bugs in it. The problems with it are:
1. In design mode, when adding accordion panes, the designer doesn't put the
<Panes> tag around the pane controls.
2. You have to remove the accordion_extender control from the accordion
control since it appears that a "accordion_extender" never has existed.
3. It appears that you have to manually insert the SelectedIndex="..."
property since the designer fails to include it in the code.
They are all not that hard to work around though (after trying to figure it
out for a while). So, at this point, not for sure what to think. HTH...
"Wannabe" <Wannabe@.discussions.microsoft.com> wrote in message
news:E2A43F2B-68C8-4B85-93EC-1645FE7C7F33@.microsoft.com...
> We are looking at Ajaxing our existing web application. Question
> is...Should
> we Ajax any and everything we can, or not? One example...if a page posts
> back
> to itself, is that a good candidate for Ajax?
Anything and everything?
Probably not.
The great programmers answer is...
"It depends."
Postbacks that are only going to cause a small update to the page are a
great place to start.
I certainly wouldn't make the entire website one great big
postback/updatepanel. While it would be an interesting concept, it would
probably be more work to maintain then it is worth. It would also give
you a one page web site from a search engine perspective.
--Original Message--
From: Wannabe [mailto:Wannabe@.discussions.microsoft.com]
Posted At: Wednesday, November 28, 2007 4:52 PM
Posted To: microsoft.public.dotnet.framework.aspnet
Conversation: Why use Ajax -- All comments welcome
Subject: Why use Ajax -- All comments welcome
We are looking at Ajaxing our existing web application. Question
is...Should
we Ajax any and everything we can, or not? One example...if a page posts
back
to itself, is that a good candidate for Ajax?
As the others have said, when you need partial page updating, Ajax is a good
candidate. But, I have seen sites that use it excessively. I saw one site
that used it to implement tabbing behavior on their home page to simulate
that one page being 5 pages. Each time you simply hovered, not even
clicked, a tab the first tabs contents would go away and the next tab's
contents would appear. Since, really, the whole displayed content was being
replaced the only benefit of Ajax was that the screen didn't flicker, as it
would with a normal page.
"Wannabe" <Wannabe@.discussions.microsoft.com> wrote in message
news:E2A43F2B-68C8-4B85-93EC-1645FE7C7F33@.microsoft.com...
> We are looking at Ajaxing our existing web application. Question
> is...Should
> we Ajax any and everything we can, or not? One example...if a page posts
> back
> to itself, is that a good candidate for Ajax?
Depends on TimeFrame, Budget and needs of your users.
I would start by adding some easy partial rendering (not abusing, e.g. just
add a nice updatepanel for a heavy grid...), find bottlenecks and apply
scriptservices where users are complaining.
But if you have the money and the time to invest... do it all scriptservices
based :-).
/// --
/// Braulio Diez
///
/// http://www.tipsdotnet.com
/// --
"Wannabe" wrote:

> We are looking at Ajaxing our existing web application. Question is...Shou
ld
> we Ajax any and everything we can, or not? One example...if a page posts b
ack
> to itself, is that a good candidate for Ajax?
"Scott M." <smar@.nospam.nospam> wrote in message
news:D9039B7E-DE17-4826-ACC9-C0B373E37AD4@.microsoft.com...
> As the others have said, when you need partial page updating, Ajax is a
> good candidate. But, I have seen sites that use it excessively. I saw
> one site that used it to implement tabbing behavior on their home page to
> simulate that one page being 5 pages. Each time you simply hovered, not
> even clicked, a tab the first tabs contents would go away and the next
> tab's contents would appear. Since, really, the whole displayed content
> was being replaced the only benefit of Ajax was that the screen didn't
> flicker, as it would with a normal page.
>
> "Wannabe" <Wannabe@.discussions.microsoft.com> wrote in message
> news:E2A43F2B-68C8-4B85-93EC-1645FE7C7F33@.microsoft.com...
>
I have a good reason. I have a site I use to play my mp3 collection. I use
the WMP control and allow myself to browse the contents of my collection
while playing. If there was a full page refresh I would interupt the
playing. All this to say that if you are trying to emulate the look and
feel of a windows app AJAX is the way to do it.
LS
"Andy B" <a_borka@.sbcglobal.net> wrote in message
news:endahPhMIHA.4136@.TK2MSFTNGP03.phx.gbl...

> Maybe. I started playing around with it a while ago to see if it would be
> useful or not and so far, I found it quite interesting. Not useful yet but
> getting there. I haven't had the chance to look at all of the controls or
> extenders yet but making my way there. I have found 1 control that could
> prove extremely useful in saving postbacks when changing content on a
> website. Its the accordion control. It can change the content of parts of
> the site without postbacks.
Keep in mind that with some (usually smaller) sites you can stuff everything
into one file and just position it/expose it on the client side with trivial
Javascript code and CSS ... one trip to the server, no postbacks, no Ajax
if there's 6 dozen pancakes on the breakfast table, and they taste really
good, should I eat all of them? probably not
use Ajax, like any other tool, where it makes sense to use it

Why use Ajax All comments welcome

We are looking at Ajaxing our existing web application. Question is...Should
we Ajax any and everything we can, or not? One example...if a page posts back
to itself, is that a good candidate for Ajax?On Nov 28, 10:52 pm, Wannabe <Wann...@.discussions.microsoft.com>
wrote:

Quote:

Originally Posted by

We are looking at Ajaxing our existing web application. Question is...Should
we Ajax any and everything we can, or not? One example...if a page posts back
to itself, is that a good candidate for Ajax?


If it's posted back just to execute some server code and to update a
part of the page (for example just to show a message "record saved")
then it could be done using Ajax. The advantage of Ajax here would be
an update of piece of web page without reloading the entire page.

To be or not be is the question :-)
Maybe. I started playing around with it a while ago to see if it would be
useful or not and so far, I found it quite interesting. Not useful yet but
getting there. I haven't had the chance to look at all of the controls or
extenders yet but making my way there. I have found 1 control that could
prove extremely useful in saving postbacks when changing content on a
website. Its the accordion control. It can change the content of parts of
the site without postbacks. The update pannel is the same way. I have been
tempted to ajax up every possible place possible on my website, but hold
off. Guess I'm sort of conservative on that point (don't do it unless its
required). Part of this is company saying it has to be that way but...if it
were my choice?...

Either way, it looks like a good choice. If you use the accordion control,
watch out because it has a few bugs in it. The problems with it are:

1. In design mode, when adding accordion panes, the designer doesn't put the
<Panestag around the pane controls.
2. You have to remove the accordion_extender control from the accordion
control since it appears that a "accordion_extender" never has existed.
3. It appears that you have to manually insert the SelectedIndex="..."
property since the designer fails to include it in the code.

They are all not that hard to work around though (after trying to figure it
out for a while). So, at this point, not for sure what to think. HTH...

"Wannabe" <Wannabe@.discussions.microsoft.comwrote in message
news:E2A43F2B-68C8-4B85-93EC-1645FE7C7F33@.microsoft.com...

Quote:

Originally Posted by

We are looking at Ajaxing our existing web application. Question
is...Should
we Ajax any and everything we can, or not? One example...if a page posts
back
to itself, is that a good candidate for Ajax?


Anything and everything?

Probably not.

The great programmers answer is...
"It depends."

Postbacks that are only going to cause a small update to the page are a
great place to start.

I certainly wouldn't make the entire website one great big
postback/updatepanel. While it would be an interesting concept, it would
probably be more work to maintain then it is worth. It would also give
you a one page web site from a search engine perspective.

--Original Message--
From: Wannabe [mailto:Wannabe@.discussions.microsoft.com]
Posted At: Wednesday, November 28, 2007 4:52 PM
Posted To: microsoft.public.dotnet.framework.aspnet
Conversation: Why use Ajax -- All comments welcome
Subject: Why use Ajax -- All comments welcome

We are looking at Ajaxing our existing web application. Question
is...Should
we Ajax any and everything we can, or not? One example...if a page posts
back
to itself, is that a good candidate for Ajax?
As the others have said, when you need partial page updating, Ajax is a good
candidate. But, I have seen sites that use it excessively. I saw one site
that used it to implement tabbing behavior on their home page to simulate
that one page being 5 pages. Each time you simply hovered, not even
clicked, a tab the first tabs contents would go away and the next tab's
contents would appear. Since, really, the whole displayed content was being
replaced the only benefit of Ajax was that the screen didn't flicker, as it
would with a normal page.

"Wannabe" <Wannabe@.discussions.microsoft.comwrote in message
news:E2A43F2B-68C8-4B85-93EC-1645FE7C7F33@.microsoft.com...

Quote:

Originally Posted by

We are looking at Ajaxing our existing web application. Question
is...Should
we Ajax any and everything we can, or not? One example...if a page posts
back
to itself, is that a good candidate for Ajax?


Depends on TimeFrame, Budget and needs of your users.

I would start by adding some easy partial rendering (not abusing, e.g. just
add a nice updatepanel for a heavy grid...), find bottlenecks and apply
scriptservices where users are complaining.

But if you have the money and the time to invest... do it all scriptservices
based :-).

/// ----------
/// Braulio Diez
///
/// http://www.tipsdotnet.com
/// ----------

"Wannabe" wrote:

Quote:

Originally Posted by

We are looking at Ajaxing our existing web application. Question is...Should
we Ajax any and everything we can, or not? One example...if a page posts back
to itself, is that a good candidate for Ajax?


"Scott M." <smar@.nospam.nospamwrote in message
news:D9039B7E-DE17-4826-ACC9-C0B373E37AD4@.microsoft.com...

Quote:

Originally Posted by

As the others have said, when you need partial page updating, Ajax is a
good candidate. But, I have seen sites that use it excessively. I saw
one site that used it to implement tabbing behavior on their home page to
simulate that one page being 5 pages. Each time you simply hovered, not
even clicked, a tab the first tabs contents would go away and the next
tab's contents would appear. Since, really, the whole displayed content
was being replaced the only benefit of Ajax was that the screen didn't
flicker, as it would with a normal page.
>
>
"Wannabe" <Wannabe@.discussions.microsoft.comwrote in message
news:E2A43F2B-68C8-4B85-93EC-1645FE7C7F33@.microsoft.com...

Quote:

Originally Posted by

>We are looking at Ajaxing our existing web application. Question
>is...Should
>we Ajax any and everything we can, or not? One example...if a page posts
>back
>to itself, is that a good candidate for Ajax?


>


I have a good reason. I have a site I use to play my mp3 collection. I use
the WMP control and allow myself to browse the contents of my collection
while playing. If there was a full page refresh I would interupt the
playing. All this to say that if you are trying to emulate the look and
feel of a windows app AJAX is the way to do it.

LS
"Andy B" <a_borka@.sbcglobal.netwrote in message
news:endahPhMIHA.4136@.TK2MSFTNGP03.phx.gbl...

Quote:

Originally Posted by

Maybe. I started playing around with it a while ago to see if it would be
useful or not and so far, I found it quite interesting. Not useful yet but
getting there. I haven't had the chance to look at all of the controls or
extenders yet but making my way there. I have found 1 control that could
prove extremely useful in saving postbacks when changing content on a
website. Its the accordion control. It can change the content of parts of
the site without postbacks.


Keep in mind that with some (usually smaller) sites you can stuff everything
into one file and just position it/expose it on the client side with trivial
Javascript code and CSS ... one trip to the server, no postbacks, no Ajax

Quote:

Originally Posted by

Quote:

Originally Posted by

>Should
>we Ajax any and everything we can, or not?


if there's 6 dozen pancakes on the breakfast table, and they taste really
good, should I eat all of them? probably not

use Ajax, like any other tool, where it makes sense to use it

Why use asp controls instead of HTML inputs?

I am coming at the world from the standpoint of a veteran ASP Classic
developer. I am not clear on the advantages of using the ASP.NET control
over standard HTML control.
With the ASP.NET controls the rendered names are changed and I appear to be
limited in what javascript events I can fire. I also can not seem to figure
out how to setup a onsubmit() event.
With standard HTML I can setup any javascript event I want and the names
don't change. I can also use multiple forms and do onsubmit().
To go along with this I haven't figured out the advantage of the validation
controls. It looks to me like it renders a new javascript library file that
is generated dynamically every time the page fires.
In my ASP classic developement I have a set of library files/functions that
handles validation and then displays a nice validation message as well as
changes the label color for input fields.
Many of my forms make use of a great deal of dhtml to hide/show different
elements on the page as needed. I make use of callbacks so I don't ever hav
e
to do a postback because I don't want the redraw and I don't want to have to
try to setup the page (tabs, show/hide elements, expand/collapse parts of
trees) to do validation.
Can I get this kind of flexibility out of asp.net controls? Or should I
stick with HTML controls and using the good old request.form() on post back?
Lastly, the market that I develope for uses browser from IE5 Mac up throught
IE7. So I can't have solutions that don't work on all browsers. (I might b
e
able to abandon IE5 Mac, but Safari will have to stay).
I would love any input you all have. I am trying to understand this new
world and don't want to sell any part of it short because it doesn't look
like what I am used to.
Thanks,
Shawn Ramirez
www.dynacal.comIt's basically trying to allow people to code web sites without knowing how
web sites work. RAD gone a little bit crazy.
The major advantage with ASP.net controls is that you don't have to use the
Request.Form much anymore, controls retain their values when the form
submits and you refer to them like WinForm controls. The other main
advantage of doing things the asp.net way is that your aspx page has no code
at all, just the controls, and your code-behind has all the code.
It takes a while to get your head around it and get used to it but you get
there in the end.
If you need to render literal HTML then do so, I use a mix where I use
controls if I can, and if I can't then I can't. Like you say, a site that
needs DIVs hidden/shown will often have you writing out literal HTML to give
the DIV's known IDs etc. Just use the tools to make your project work.
Ditto I don't bother with the validation controls, or TBH 90% of what is new
in 2.0. Most of it is for people to produce sites without knowing how to
code, so don't feel bad if you think you're not using everything it has to
offer. RAD development is not good development.
"Shawn Ramirez" <ShawnRamirez@.discussions.microsoft.com> wrote in message
news:2B4383EF-7534-4B34-9933-A0113B50A780@.microsoft.com...
>I am coming at the world from the standpoint of a veteran ASP Classic
> developer. I am not clear on the advantages of using the ASP.NET control
> over standard HTML control.
> With the ASP.NET controls the rendered names are changed and I appear to
> be
> limited in what javascript events I can fire. I also can not seem to
> figure
> out how to setup a onsubmit() event.
> With standard HTML I can setup any javascript event I want and the names
> don't change. I can also use multiple forms and do onsubmit().
> To go along with this I haven't figured out the advantage of the
> validation
> controls. It looks to me like it renders a new javascript library file
> that
> is generated dynamically every time the page fires.
> In my ASP classic developement I have a set of library files/functions
> that
> handles validation and then displays a nice validation message as well as
> changes the label color for input fields.
> Many of my forms make use of a great deal of dhtml to hide/show different
> elements on the page as needed. I make use of callbacks so I don't ever
> have
> to do a postback because I don't want the redraw and I don't want to have
> to
> try to setup the page (tabs, show/hide elements, expand/collapse parts of
> trees) to do validation.
> Can I get this kind of flexibility out of asp.net controls? Or should I
> stick with HTML controls and using the good old request.form() on post
> back?
> Lastly, the market that I develope for uses browser from IE5 Mac up
> throught
> IE7. So I can't have solutions that don't work on all browsers. (I might
> be
> able to abandon IE5 Mac, but Safari will have to stay).
> I would love any input you all have. I am trying to understand this new
> world and don't want to sell any part of it short because it doesn't look
> like what I am used to.
> Thanks,
> Shawn Ramirez
> www.dynacal.com
ASP.Net has many advantages over Classic ASP, and is much more powerful
overall, but the additional power requires a corresponding amount of work to
master. For one thing, ASP.Net is object-oriented, and that means a lot. If
you're not familiar with OOP, I suggest you read up on it. The advantages of
OOP over procedural programming are many. Basically, OOP extends the idea of
functions and structures in procedural programming, which are based on the
idea of creating reusable "components" that you can employ without having to
re-invent the wheel for every new project. Objects are encapsulations of
both process and state, with extra features built in that simplify
programming overall. But I digress.
It isn't necessary to jump on the ASP.Net bandwagon immediately, but at some
point you will have to adapt to the new object-oriented paradigm. The
procedural paradigm does not have legs any more, and Classic ASP, along with
other procedural technologies will, for most of us, die out in a few short
years.
ASP.Net uses a programming model which is more strict than the Classic ASP
programming model. This has both positive and negative consequences, but the
positives outweigh the negatives by a long shot. On the negative side, you
have to familiarize yourself with the programming model, the Control
LifeCycle, and the dozens of essential classes that are used. You are
generally going to be working at a much higher level of abstraction. Once
you have learned the programming model, and familiarized yourself with the
various Controls, patterns, and practices of ASP.Net, it becomes much
easier. You also have the advantage of working in a medium for which there
are stricter standards, which means that not only will your code be more
extensible and reusable, but it will fit in better with the code of other
ASP.Net developers. This can come in handy when you work with a team or
another contractor, and when you need help in the form of a tutorial or a
pre-built component. The strictness of ASP.Net has all of the same
advantages that the strictness of XHTML has over traditional HTML.
ASP.Net works well in any browser, and has capabilities of adapting the HTML
it renders to specific browsers.
As for flexibility, you can get all the flexibility you need out of ASP.Net.
You can go anywhere you want to go, and do anything you can imagine. You are
not confined to using ASP.Net Controls at all times, and indeed, the ASP.Net
programming model employs "static" HTML as an integral part.
Again, you don't have to suddenly move into it. I would suggest
familiarizing yourself with it over a period of time and making a gradual
transition.
HTH,
Kevin Spencer
Microsoft MVP
Printing Components, Email Components,
FTP Client Classes, Enhanced Data Controls, much more.
DSI PrintManager, Miradyne Component Libraries:
http://www.miradyne.net
"Shawn Ramirez" <ShawnRamirez@.discussions.microsoft.com> wrote in message
news:2B4383EF-7534-4B34-9933-A0113B50A780@.microsoft.com...
>I am coming at the world from the standpoint of a veteran ASP Classic
> developer. I am not clear on the advantages of using the ASP.NET control
> over standard HTML control.
> With the ASP.NET controls the rendered names are changed and I appear to
> be
> limited in what javascript events I can fire. I also can not seem to
> figure
> out how to setup a onsubmit() event.
> With standard HTML I can setup any javascript event I want and the names
> don't change. I can also use multiple forms and do onsubmit().
> To go along with this I haven't figured out the advantage of the
> validation
> controls. It looks to me like it renders a new javascript library file
> that
> is generated dynamically every time the page fires.
> In my ASP classic developement I have a set of library files/functions
> that
> handles validation and then displays a nice validation message as well as
> changes the label color for input fields.
> Many of my forms make use of a great deal of dhtml to hide/show different
> elements on the page as needed. I make use of callbacks so I don't ever
> have
> to do a postback because I don't want the redraw and I don't want to have
> to
> try to setup the page (tabs, show/hide elements, expand/collapse parts of
> trees) to do validation.
> Can I get this kind of flexibility out of asp.net controls? Or should I
> stick with HTML controls and using the good old request.form() on post
> back?
> Lastly, the market that I develope for uses browser from IE5 Mac up
> throught
> IE7. So I can't have solutions that don't work on all browsers. (I might
> be
> able to abandon IE5 Mac, but Safari will have to stay).
> I would love any input you all have. I am trying to understand this new
> world and don't want to sell any part of it short because it doesn't look
> like what I am used to.
> Thanks,
> Shawn Ramirez
> www.dynacal.com
Thank you for your input.
I understand OOP and used it with Classic, as far as it would allow. Being
able to use true collections is a big reason why I am interested in going to
.Net since I had to make my own collection system work in Classic.
I think you are correct in that it is going to take me some time. I think
this is in part because I could do some things in classic with a very few
lines of code that will take more code in .net (like using the attribute
property).
The big thing for me right now is going to be trying to figure out how to do
validation. I still want to do it client side (99% of it), and i want to be
able to have the browser download the page's javascript validation library 1
time, not a new library file everytime the page loads.
Again, thanks for your help.
Shawn
"Kevin Spencer" wrote:

> ASP.Net has many advantages over Classic ASP, and is much more powerful
> overall, but the additional power requires a corresponding amount of work
to
> master. For one thing, ASP.Net is object-oriented, and that means a lot. I
f
> you're not familiar with OOP, I suggest you read up on it. The advantages
of
> OOP over procedural programming are many. Basically, OOP extends the idea
of
> functions and structures in procedural programming, which are based on the
> idea of creating reusable "components" that you can employ without having
to
> re-invent the wheel for every new project. Objects are encapsulations of
> both process and state, with extra features built in that simplify
> programming overall. But I digress.
> It isn't necessary to jump on the ASP.Net bandwagon immediately, but at so
me
> point you will have to adapt to the new object-oriented paradigm. The
> procedural paradigm does not have legs any more, and Classic ASP, along wi
th
> other procedural technologies will, for most of us, die out in a few short
> years.
> ASP.Net uses a programming model which is more strict than the Classic ASP
> programming model. This has both positive and negative consequences, but t
he
> positives outweigh the negatives by a long shot. On the negative side, you
> have to familiarize yourself with the programming model, the Control
> LifeCycle, and the dozens of essential classes that are used. You are
> generally going to be working at a much higher level of abstraction. Once
> you have learned the programming model, and familiarized yourself with the
> various Controls, patterns, and practices of ASP.Net, it becomes much
> easier. You also have the advantage of working in a medium for which there
> are stricter standards, which means that not only will your code be more
> extensible and reusable, but it will fit in better with the code of other
> ASP.Net developers. This can come in handy when you work with a team or
> another contractor, and when you need help in the form of a tutorial or a
> pre-built component. The strictness of ASP.Net has all of the same
> advantages that the strictness of XHTML has over traditional HTML.
> ASP.Net works well in any browser, and has capabilities of adapting the HT
ML
> it renders to specific browsers.
> As for flexibility, you can get all the flexibility you need out of ASP.Ne
t.
> You can go anywhere you want to go, and do anything you can imagine. You a
re
> not confined to using ASP.Net Controls at all times, and indeed, the ASP.N
et
> programming model employs "static" HTML as an integral part.
> Again, you don't have to suddenly move into it. I would suggest
> familiarizing yourself with it over a period of time and making a gradual
> transition.
> --
> HTH,
> Kevin Spencer
> Microsoft MVP
> Printing Components, Email Components,
> FTP Client Classes, Enhanced Data Controls, much more.
> DSI PrintManager, Miradyne Component Libraries:
> http://www.miradyne.net
> "Shawn Ramirez" <ShawnRamirez@.discussions.microsoft.com> wrote in message
> news:2B4383EF-7534-4B34-9933-A0113B50A780@.microsoft.com...
>
>
You can certainly implement your own client-side validation model, and use
an external .js file to do it, if you wish. If you're using ASP.Net,
however, be sure to take the ASP.Net programming model, including PostBack,
into account in your design.
HTH,
Kevin Spencer
Microsoft MVP
Printing Components, Email Components,
FTP Client Classes, Enhanced Data Controls, much more.
DSI PrintManager, Miradyne Component Libraries:
http://www.miradyne.net
"Shawn Ramirez" <ShawnRamirez@.discussions.microsoft.com> wrote in message
news:2C9B4DFC-DAD8-42BB-8E19-F0C0000EB474@.microsoft.com...
> Thank you for your input.
> I understand OOP and used it with Classic, as far as it would allow.
> Being
> able to use true collections is a big reason why I am interested in going
> to
> .Net since I had to make my own collection system work in Classic.
> I think you are correct in that it is going to take me some time. I think
> this is in part because I could do some things in classic with a very few
> lines of code that will take more code in .net (like using the attribute
> property).
> The big thing for me right now is going to be trying to figure out how to
> do
> validation. I still want to do it client side (99% of it), and i want to
> be
> able to have the browser download the page's javascript validation library
> 1
> time, not a new library file everytime the page loads.
> Again, thanks for your help.
> Shawn
>
> "Kevin Spencer" wrote:
>
"Kevin Spencer" <unclechutney@.nothinks.com> wrote in message
news:O%239xSUGnHHA.3656@.TK2MSFTNGP06.phx.gbl...

> You can certainly implement your own client-side validation model, and use
> an external .js file to do it, if you wish.
That's certainly what I do - wouldn't go anywhere near the validation
controls...
http://www.markrae.net
Can you give me an few pointers or articles on how you accomplished this?
Thanks for any help you might be able to offer.
Shawn Ramirez
"Mark Rae" wrote:

> "Kevin Spencer" <unclechutney@.nothinks.com> wrote in message
> news:O%239xSUGnHHA.3656@.TK2MSFTNGP06.phx.gbl...
>
> That's certainly what I do - wouldn't go anywhere near the validation
> controls...
>
> --
> http://www.markrae.net
>
"Shawn Ramirez" <ShawnRamirez@.discussions.microsoft.com> wrote in message
news:602039D1-D4AC-4BAB-9559-7CE5A92C7C9A@.microsoft.com...

> Can you give me an few pointers or articles on how you accomplished this?
1) Create a JavaScript file called, say, validation.js and import it into
your project
2) Set a reference to it in the pages which require it:
<script type="text/javascript" src="http://pics.10026.com/?src=../includes/js/validation.js"></script>
3) Add the first validation routine to it - the following one checks for
valid email addresses:
function isEmailAddress(pstrEmailAddress)
{
var astrIllegalChars = /[\(\)\<\>\,\;\:\\\/\"\[\]]/;
if (pstrEmailAddress.match(astrIllegalChars))
{
return false;
}
return
/^\w+([\.-]?\w+)*@.\w+([\.-]?\w+)*(\.\w{2,4})+$/.test(pstrEmailAddress);
}
4) Use it in the pages which need it e.g.
<script type="text/javascript">
<!--
function validateForm()
{
if(document.getElementById('<%=txtEmail.ClientID %>').value.length
== 0)
{
document.getElementById('<%=txtEmail.ClientID %>').focus();
alert("Please enter your email address");
return false;
}
if(!isEmailAddress(document.getElementById('<%=txtEmail.ClientID
%>').value))
{
document.getElementById('<%=txtEmail.ClientID %>').focus();
alert("Invalid email address - please enter in the standard
format e.g.\n\njoe.bloggs@.domain.com");
return false;
}
}
</script>
<form runat="server">
<asp:TextBox ID="txtEmail" runat="server"
<br />
<asp:Button ID="cmdSend" runat="server" Text="Send"
OnClick="cmdSend_Click" OnClientClick="return validateForm();" />
</form>
http://www.markrae.net
Thanks very much for your help.
Shawn
"Mark Rae" wrote:

> "Shawn Ramirez" <ShawnRamirez@.discussions.microsoft.com> wrote in message
> news:602039D1-D4AC-4BAB-9559-7CE5A92C7C9A@.microsoft.com...
>
> 1) Create a JavaScript file called, say, validation.js and import it into
> your project
> 2) Set a reference to it in the pages which require it:
> <script type="text/javascript" src="http://pics.10026.com/?src=../includes/js/validation.js"></script
>
> 3) Add the first validation routine to it - the following one checks for
> valid email addresses:
> function isEmailAddress(pstrEmailAddress)
> {
> var astrIllegalChars = /[\(\)\<\>\,\;\:\\\/\"\[\]]/;
> if (pstrEmailAddress.match(astrIllegalChars))
> {
> return false;
> }
> return
> /^\w+([\.-]?\w+)*@.\w+([\.-]?\w+)*(\.\w{2,4})+$/.test(pstrEmailAddress);
> }
>
> 4) Use it in the pages which need it e.g.
> <script type="text/javascript">
> <!--
> function validateForm()
> {
> if(document.getElementById('<%=txtEmail.ClientID %>').value.length
> == 0)
> {
> document.getElementById('<%=txtEmail.ClientID %>').focus();
> alert("Please enter your email address");
> return false;
> }
> if(!isEmailAddress(document.getElementById('<%=txtEmail.ClientID
> %>').value))
> {
> document.getElementById('<%=txtEmail.ClientID %>').focus();
> alert("Invalid email address - please enter in the standard
> format e.g.\n\njoe.bloggs@.domain.com");
> return false;
> }
> }
> </script>
>
> <form runat="server">
> <asp:TextBox ID="txtEmail" runat="server"
> <br />
> <asp:Button ID="cmdSend" runat="server" Text="Send"
> OnClick="cmdSend_Click" OnClientClick="return validateForm();" />
> </form>
>
> --
> http://www.markrae.net
>