473,394 Members | 1,703 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,394 software developers and data experts.

gridview template controls and validators

I have a gridview with templates and textboxes i'm putting i want to put the
validator in a template at the last cell. How can i get the validator to see
the textbox if i create it and move it it does not validate.

is there a work around?
--
(i''ll be asking a lot of these, but I find C# totally way cooler than vb
and there''s no go''n back!!!)
thanks (as always)

kes
Jul 16 '08 #1
2 1262
Well i'm on a roll today!
this is how i do it
in the gridview row databound event
if (e.Row.RowType == DataControlRowType.DataRow)
{

((RequiredFieldValidator)e.Row.FindControl("REquir edFieldFirstName")).ControlToValidate = ((TextBox)e.Row.FindControl("TextBoxFirstName")).I D;

}
--
YID
"WebBuilder451" wrote:
I have a gridview with templates and textboxes i'm putting i want to put the
validator in a template at the last cell. How can i get the validator to see
the textbox if i create it and move it it does not validate.

is there a work around?
--
(i''ll be asking a lot of these, but I find C# totally way cooler than vb
and there''s no go''n back!!!)
thanks (as always)

kes
Jul 16 '08 #2
found the answer my accident!!! but it works, albeit wordy.
--
(i''ll be asking a lot of these, but I find C# totally way cooler than vb
and there''s no go''n back!!!)
thanks (as always)

kes
"WebBuilder451" wrote:
Well i'm on a roll today!
this is how i do it
in the gridview row databound event
if (e.Row.RowType == DataControlRowType.DataRow)
{

((RequiredFieldValidator)e.Row.FindControl("REquir edFieldFirstName")).ControlToValidate = ((TextBox)e.Row.FindControl("TextBoxFirstName")).I D;

}
--
YID
"WebBuilder451" wrote:
I have a gridview with templates and textboxes i'm putting i want to put the
validator in a template at the last cell. How can i get the validator to see
the textbox if i create it and move it it does not validate.

is there a work around?
--
(i''ll be asking a lot of these, but I find C# totally way cooler than vb
and there''s no go''n back!!!)
thanks (as always)

kes
Jul 16 '08 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Miguel Dias Moura | last post by:
Hello, I have a GridView in my page which is created in runtime. It works fine. My page has 2 Asp Buttons: - The HIDE button makes GridView.Visible = False; - The SHOW button makes...
7
by: GaryDean | last post by:
I'm trying to load a GridView up with data manually, in code. I'm not using any datasource. Using this code.... ArrayList myRowArrayList; GridViewRow myGVR = new...
0
by: shapper | last post by:
Hello, I am trying to create a ItemTemplate at runtime for a ComponentArt Grid. This GridView works in a very similar way to the Asp.Net 2.0 GridView so the implementation method should be...
0
by: =?Utf-8?B?TGFkaXNsYXYgTXJua2E=?= | last post by:
Hello, I read some msdn and other articles about how does databinding among DataSource controls and FormView / GridView controls works but I still don't fully understand to this blackbox. I have...
4
by: Tomasz | last post by:
Hello Developers, Here is interesting problem I just came across: how do I wire a GridView control programmatically? Here is my sample code using Object Data Source: protected void...
4
by: beton3000 | last post by:
Hello! I'm building a GridView using code to add template fields, because there is a random number of columns in result set from database. I'm using a class with ITemplate interface for defining...
2
by: Tim Royal | last post by:
I'm using a GridView inside a Wizard Control with a textbox and two listboxes in the footer. I populate these listboxes from the database if the page isn't on postback (and the textbox is left...
4
by: Craig Buchanan | last post by:
I dynamically add data-bound templates to a gridview in my ascx control. while this works correctly when the gridview is databound to the datatable, i'm having issues on postback. i would like...
1
by: Mel | last post by:
I have a GridView that is bound to a DataTable. I decided to allow the user to change the column data right in the ItemTemplate. Then user won't need to click Edit to change the values and then...
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...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.