Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Weird typing in ASP.NET
Message
General information
Forum:
ASP.NET
Category:
Other
Title:
Weird typing in ASP.NET
Environment versions
Environment:
ASP.NET
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01471265
Message ID:
01471265
Views:
102
I sort of understand this casting or typing subject in ASP.NET, and C# specifically, but it's just weird, coming from a Visual FoxPro background. An example of this follows from Stephen Walther's book, titled "ASP.NET 3.5 Unleashed". The value that is found with the FindControl function is already coming from a textbox, and yet the value has to be Typed as a TextBox? Or, maybe it's not quite a TextBox, because the FindControl() function is only finding the txtSearch control on the PreviousPage, not really able to return it as a TextBox object? I suppose this is more C# language "stuff", not really confined to ASP.NET. As a VFP guy, it's a bit weird, although somewhat understandable with repetition and useage.

This code is found on page 99:
TextBox txtSearch = (TextBox)PreviousPage.FindControl("txtSearch");
lblSearch.Text = String.Format("Search For: {0}", txtSearch.Text);
Next
Reply
Map
View

Click here to load this message in the networking platform