473,385 Members | 1,333 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Access to the control in FormView

Hi! Can I get access to the TextBox control (that is included in FormView) from code behind?

Expand|Select|Wrap|Line Numbers
  1.  <asp:FormView ID="formview_NewsFull" runat="server" DataSourceID="ds_NewsFull">
  2. ...
  3.     <EditItemTemplate>
  4.       <asp:TextBox ID="newstitle"  ClientID="blahblahblah" runat="server" Text=<%#Bind("newstitle_ua")%>></asp:TextBox>
  5.     </EditItemTemplate>
  6.  
  7.  
  8.     </asp:FormView>
  9.  
  10.  
Apr 1 '12 #1

✓ answered by Frinavale

This is unrelated, but you shouldn't set the ClientID of an ASP.NET object. A ClientID is automatically generated for ASP.NET controls when they are rendered as HTML. This is done based on the ID given to the asp.net control and some other things...it ensures that every HTML element that was generated by an ASP.NET control has a unique ID so that the HTML is valid.

Anyways, to access the TextBox in your server side code, use the FormView.FindControl method and provide this method with the ID of your TextBox (not the ClientID since you want to retrieve the server object based on the server-side id).

-Frinny

3 2058
Frinavale
9,735 Expert Mod 8TB
This is unrelated, but you shouldn't set the ClientID of an ASP.NET object. A ClientID is automatically generated for ASP.NET controls when they are rendered as HTML. This is done based on the ID given to the asp.net control and some other things...it ensures that every HTML element that was generated by an ASP.NET control has a unique ID so that the HTML is valid.

Anyways, to access the TextBox in your server side code, use the FormView.FindControl method and provide this method with the ID of your TextBox (not the ClientID since you want to retrieve the server object based on the server-side id).

-Frinny
Apr 2 '12 #2
Frinavale, thank you!
Apr 2 '12 #3
Frinavale
9,735 Expert Mod 8TB
No problem!
You actually gave me an idea for my own project inadvertently :)
Apr 2 '12 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: BDob | last post by:
Standard documents "Access control is not considered in determining overriding." To further explain what's puzzling me, I put up an example below: class Base { public: virtual void...
3
by: john sun | last post by:
Hi, I don't understand one thing when authoring cp ctor. The below is simplified class and cp constructor. When initializing the data member, we use object ref TEST to access its private member...
5
by: Fabio Rossi | last post by:
Hi! I'm learning C++ from the book "Thinking in C++". Now I'm reading about nested classes and access control. I have written this code #include <iostream> class Outer { private: int...
1
by: TK | last post by:
What's the best way to implement roll-base access control with forms authentication? I have a IIS6+ASP.NET server which hosts some ASP.NET web applications as separated path that's like...
0
by: William F. Zachmann | last post by:
A web site that will run on Windows Server 2003 and IIS 6.0 needs to provide three levels of access, one for the public and two others for two levels of subscribers. This is a port of a prior site...
4
by: JimC | last post by:
On my main form in a C# program, I create an instance of another form that contains a ListView control, in the usual way, that is: public class frmMain : System.Windows.Forms.Form { // ...
6
by: Notgiven | last post by:
I am considering a large project and they currently use LDAP on MS platform. It would be moved to a LAMP platform. OpenLDAP is an option though I have not used it before. I do feel fairly...
0
by: islandfong | last post by:
Hi, I am using ASP.NET 2.0 to implement a user access control system. The idea is that I would allow users (admin) to create new role, new user, assign user to role and the role is given...
5
by: Lewis Perin | last post by:
Is anyone aware of robust software, suited to a preexisting PHP application, that handles permissions for various types of requests by role rather than user ID? I'm speaking of maintaining/editing...
8
by: xz | last post by:
Why C++ (as well as Java) adopts class-based access control instead of instance-based access control? I had never paid attention to whether an access-control is class-based or instance-based but...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.