Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Web Controls > Parser Error

Reply
Thread Tools

Parser Error

 
 
Emmweb
Guest
Posts: n/a
 
      04-07-2005
I am relatively new to the whole .NET environment. If I am posting this to
the wrong newsgroup, I apologize; please direct me.

Could anyone point me in the right direction for finding my error in the
following code? The error I get is a Parser Error on the line that starts
<asp:Text.... The exact message says "'Title(0)' is not a valid identifier.

for i=0 to (Title.Length - 1)
Title(i).Text = " "
Author(i).Text = ""
Next
....
<asp:TextBox id="Title(0)" runat="server" size = "50"></asp:TextBox>


Thanks!
Emma

 
Reply With Quote
 
 
 
 
Brock Allen
Guest
Posts: n/a
 
      04-07-2005
> <asp:TextBox id="Title(0)" runat="server" size =
> "50"></asp:TextBox>


You assign Title(0) as the ID, which is invalid. Just do ID="Title".

> for i=0 to (Title.Length - 1)
> Title(i).Text = " "
> Author(i).Text = ""
> Next


I'm not sure what this is trying to accomplish. If you want to blank out
the value of the TextBox control, just use the variable (from the ID above):

Title.Text = ""

-Brock
DevelopMentor
http://staff.develop.com/ballen






 
Reply With Quote
 
 
 
 
Emmweb
Guest
Posts: n/a
 
      04-07-2005
We're trying to create an array, using the for...next loop to initialize the
array values. Which was why we had Title(0), to call the first value of
Title. Does that help?

"Brock Allen" wrote:

> > <asp:TextBox id="Title(0)" runat="server" size =
> > "50"></asp:TextBox>

>
> You assign Title(0) as the ID, which is invalid. Just do ID="Title".
>
> > for i=0 to (Title.Length - 1)
> > Title(i).Text = " "
> > Author(i).Text = ""
> > Next

>
> I'm not sure what this is trying to accomplish. If you want to blank out
> the value of the TextBox control, just use the variable (from the ID above):
>
> Title.Text = ""
>
> -Brock
> DevelopMentor
> http://staff.develop.com/ballen
>
>
>
>
>
>
>

 
Reply With Quote
 
Brock Allen
Guest
Posts: n/a
 
      04-08-2005
You can't declaratively declare an array of controls in ASP.NET. I presume
you're trying to do what you used to do in VB6? You can dynamically create
them, though, in your code[behind]. So call "new TextBox()" and then add
that control under some other control in the page. So if you had a PlaceHolder,
then you'd do myPlaceHolder.Controls.Add(theTextBoxIJustCreated) .

Sorry for the terse post (long day).

-Brock
DevelopMentor
http://staff.develop.com/ballen



> We're trying to create an array, using the for...next loop to
> initialize the array values. Which was why we had Title(0), to call
> the first value of Title. Does that help?
>
> "Brock Allen" wrote:
>
>>> <asp:TextBox id="Title(0)" runat="server" size =
>>> "50"></asp:TextBox>

>> You assign Title(0) as the ID, which is invalid. Just do ID="Title".
>>
>>> for i=0 to (Title.Length - 1)
>>> Title(i).Text = " "
>>> Author(i).Text = ""
>>> Next

>> I'm not sure what this is trying to accomplish. If you want to blank
>> out the value of the TextBox control, just use the variable (from the
>> ID above):
>>
>> Title.Text = ""
>>
>> -Brock
>> DevelopMentor
>> http://staff.develop.com/ballen




 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
XML::Parser Installation error: XML-Parser-2.34 Sean Perl Misc 3 10-03-2006 01:23 AM
XML::Parser Installation error: XML-Parser-2.34 Sean Perl Misc 0 10-02-2006 06:20 PM
XML Parser VS HTML Parser ZOCOR Java 11 10-05-2004 01:58 PM
XMLparser: Difference between parser.setErrorHandler() vs. parser.setContentHandler() Bernd Oninger Java 0 06-09-2004 01:26 AM
XMLparser: Difference between parser.setErrorHandler() vs. parser.setContentHandler() Bernd Oninger XML 0 06-09-2004 01:26 AM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57