CodeVerge.Net Beta


   Explore    Item Entry   Register  Login  
Microsoft News
Asp.Net Forums
IBM Software
Borland Forums
Adobe Forums
Novell Forums




Can Reply:  No Members Can Edit: No Online: Yes
Zone: > NEWSGROUP > Asp.Net Forum > migration_to_asp.net.migrating_from_asp_to_asp.net Tags:
Item Type: NewsGroup Date Entered: 7/15/2007 6:22:51 AM Date Modified: Subscribers: 0 Subscribe Alert
Rate It:
NR
XPoints: N/A Replies: 3 Views: 40 Favorited: 0 Favorite
4 Items, 1 Pages 1 |< << Go >> >|
MrCoastline
Asp.Net User
Eval Statement7/15/2007 6:22:51 AM

0

In Classic ASP I could use eval to turn any string into a object reference in a for loop e.g. eval("Field" & i) to get Field1, Field2, etc.  In ASP.NET I can't seem to use eval anymore unless it is with a data bound control without getting this error:

Databinding methods such as Eval(), XPath(), and Bind() can only be used in the context of a databound control.

Right now I want to interate through a loop of FileUpload controls without having to write lenghty code to handle each one individually. I know I can use HttpFileCollection for this case, but I want to know for the general case -- is there an ASP.NET equivelant to do the above in a non-data bound manner?

 Thanks!


-- "Mark As Answer" If my reply helped you --
MrCoastline
Asp.Net User
Re: Eval Statement7/16/2007 7:59:24 AM

0

MrCoastline:

In Classic ASP I could use eval to turn any string into a object reference in a for loop e.g. eval("Field" & i) to get Field1, Field2, etc.  In ASP.NET I can't seem to use eval anymore unless it is with a data bound control without getting this error:

Databinding methods such as Eval(), XPath(), and Bind() can only be used in the context of a databound control.

Right now I want to interate through a loop of FileUpload controls without having to write lenghty code to handle each one individually. I know I can use HttpFileCollection for this case, but I want to know for the general case -- is there an ASP.NET equivelant to do the above in a non-data bound manner?

 Thanks!

To provde a detailed examle:

 ASP.NET makes me do this: 

            Select Case i
                Case 1 : PropPhoto1 = UploadPropPhoto1.FileName
                Case 2 : PropPhoto2 = UploadPropPhoto2.FileName
                Case 3 : PropPhoto3 = UploadPropPhoto3.FileName
                Case 4 : PropPhoto4 = UploadPropPhoto4.FileName
                Case 5 : PropPhoto5 = UploadPropPhoto5.FileName
                Case 6 : PropPhoto6 = UploadPropPhoto6.FileName
            End Select

When Classic ASP allowed me to do this:

            eval("PropPhoto" & i = eval("UploadPropPhoto" & i).filename

I have to believe ASP.NET allows a way that is just as easy?

 


-- "Mark As Answer" If my reply helped you --
Zhao Ji Ma - MS
Asp.Net User
Re: Eval Statement7/16/2007 8:23:51 AM

0

Hi MrCoastline,

I guess you are probably looking for ASP.NET Expression, e.g.:

Contact: <%# ( customer.First Name + " " + customer.LastName ) %>


Zhao Ji Ma
Sincerely,
Microsoft Online Community Support

?Please remember to click ?Mark as Answer? on the post that helps you, and to click ?Unmark as Answer? if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread. ?
MrCoastline
Asp.Net User
Re: Eval Statement7/17/2007 4:16:17 AM

0

Zhao Ji Ma - MSFT:

I guess you are probably looking for ASP.NET Expression, e.g.:
Contact: <%# ( customer.First Name + " " + customer.LastName ) %>

I am not trying to concat.  If you look again you will see that the control names themselves are being dynamically created by the eval statement within a loop using the variable i.  The purpose is to write a statement that you can loop rather than having to write a seperate statement to handle each control name.  Here is another example I have used with Classic ASP which will evaluate to variables called fld1_PrdManufID, fld2_PrdManufID, fld3_PrdManufID, fld4_PrdManufID.

for i = 1 to 4 
Response.write eval("fld" & i & "_PrdManufID"))
next

 


-- "Mark As Answer" If my reply helped you --
4 Items, 1 Pages 1 |< << Go >> >|


Free Download:

Books:
Learn Perl in a Weekend Authors: Thomas Nowers, Tom Gutschmidt, Pages: 327, Published: 2002
Pro Ajax and the .NET 2.0 Platform Authors: Daniel Woolston, Pages: 463, Published: 2006
Programming in RPG IV Authors: Bryan Meyers, Bryan Meyers & Judy Yaeger, Judy Yaeger, Pages: 453, Published: 2002
1990 International Conference on Computer Languages: Proc Eedings : March 12-15, 1990, New Orleans, Louisiana Authors: IEEE Computer Society Technical Committee on Computer Languages, Pages: 307, Published: 1990
Classic Shell Scripting: Hidden Commands that Unlock the Power of Unix Authors: Arnold Robbins, Nelson H. F. Beebe, Pages: 534, Published: 2005
Programming in Modula-3: An Introduction in Programming with Style Authors: László Böszörményi, Carsten Weich, Pages: 571, Published: 1996
Beginning ASP.NET 2.0 Databases: From Novice to Professional Authors: Damien Foggon, Pages: 625, Published: 2006

Web:
EVAL statement Mar 11, 2008 ... Variables declared within an EVAL statement do not exist outside that EVAL statement. In this way EVAL is similar to a function, ...
Eval Statement - ASP.NET Forums If you look again you will see that the control names themselves are being dynamically created by the eval statement within a loop using the ...
C# Eval: An Embeddable Compiler - Miguel de Icaza Sep 10, 2008 ... After the C# Interactive Shell started working, it became obvious that we now had C#'s eval and that it would be incredibly interesting to ...
CodeProject: Runtime Compilation (A .NET eval statement). Free ... Jan 13, 2006 ... An article on a new library, allowing easy, language-independent access to runtime compilation.; Author: Eric Astor; Section: .
databinder.eval statement Resources | TechRepublic Feb 29, 2008 ... White papers, case studies, technical articles, and blog posts relating to databinder.eval statement.
FES EVALUATION STATEMENT FES EVALUATION STATEMENT. TITLE-SERIES-GRADE: Clinical Applications Coordinator, GS-601-12. ORGANIZATION: Professional Services Department, ...
The eval statement The eval statement is used to evaluate valid Python expressions which are stored in a string. A simple example is shown below. >>> eval('2*3') 6 ...
Scope problem in closures with an eval statement The problem is that this example doesn't work because the eval statement is compiled at run-time where it is called, that is outside of the ...
Javascript: eval statement, syntax error, loop through syntax error, loop through, naming convention: Hi there Kyle, You can try to use the getElementById() method, or the getElementsByName() method.
Re: Hyperlink Eval Statement Problem Re: Hyperlink Eval Statement Problem. I saw that the process of inserting that link had wrapped the targeturl within 2 sets of "<%#. ...

Videos:
Послание Федеральному Собранию РФ Д. Медведев Part 1 Послание Федеральному Собранию Российской Федерации 5 ноября 2008 года Москва,Большой Кремлёвский дворец Part 1 Address to the Federal ...
Ron Paul: Has the Republican Party lost it's way? An Evaluation of Ron Paul's statement: "I think the Party (Republican Party) has lost it's way." compared to Republican President Eisenhower's ...
Clustering Aggregation Google TechTalks March 22, 2006 Aristides Gionis Aristides Gionis received his Ph.D. from Stanford University in 2003, and he is currently ...
MANKIND(If I Ever Lose My Faith In You)NASA:DAWN-MISSION NASA Reinstates Dawn Asteroid Mission The Dawn of Time by Staff Writers Washington DC (SPX) Mar 27, 2006 NASA officials announced Monday ...
Under Surveillance Pre-staged Master of Fine Arts review intended to spoof the evaluation process practiced by institutions. Artists Statement: My senses chart ...
The elevator pitch Opportunity Evaluation Techniques 4: The elevator pitch is a short well articulated statement of what the business concept is. It is used to pitch ...
CIS12_ITO.avi Lecture Slides of CIS12-3. Inputs, Outputs, Tools and Techniques of all 44 PMBOK(R) processes. Every process is in one of the nine knowledge ...
Rosalind Franklin, DNA Discoveries in Science and Art Rosalind Franklin, was the scientist who made the first clear X-ray images of the structure of DNA. Artists Wyllie O Hagan discovered Franklin ...
Hear Inc * Canton, Ohio (330) 478-3350 Hear Inc - www.hearinc.biz 2416 Whipple Ave NW, Canton - (330) 478-3350 Many businesses define themselves by a goal statement, a vision ...
UWTV CSE 142 - Computer Programming I, Lecture 4 In this series of lectures, Martin Dickey, from the University of Washington teaches Computer Programming using the C Language. *Important note ...






clean xhtml code with asp.net 2.0 controls

inefficient themes applied by css: web part zones

themes

navigation menus

menu control simulating sitemappath

staticselectedstyle for a menu control

menu control questions

app built with master page having rendering issues on postback

site map structure question

treeview sitemap, control expand / collapse

clinet side scriptin in master pages using javascript

treeview and javascript

need help on creating a dynamic page. - we use master pages and this is how i am trying to accomplish it.

tree view sitemap nodes

how to override master events?

repainting master page after page has been loaded

menu control

skinid property is disabled

trouble with master page

virtual directory

creating a footer using web.sitemap

sitemappath & menu bar(navigation)

button click event

virtual path provider

access a controlparameter for formview placed in a contentplaceholder?

treeview xml datasource on the fly

what i see is not what i get!!! (cell's borders and css styles)

add atribute to menu's items(asp.net2)

theform undefined

theme, master page

   
  Privacy | Contact Us
All Times Are GMT