Category Archives: DynamicDataManager


[RESOLVED]can you use the RequiredFieldValidator with a GridView data control in Visual Web Developer?

I'm new to Visual Web Developer.  I've created a web form with a GridView
displaying information from a SQL table, and enabled editing. Now I'd like
to add validation to several fields. I've tried using the
RequiredFieldValidator but am not having much luck. Could the reason be
that the GridView doesn't use TextBoxes per se? Rather I see it uses
asp:BoundFields with DataField attributes, not TextBoxes with id attributes.

My goal is to be able to build web forms that interact with SQL tables. If you know of an easier/better way to do it than I'm attempting,
please let me know

Thanks for any help/direction


to your reqfieldvalidators you need to use TemplateFields instead of boundfields .. 

<asp:TemplateField HeaderText="FirstName" SortExpression="FirstName">
        <asp:TextBox ID="TextBox1" runat="server"
            Text='<%# Bind("FirstName") %>'></asp:TextBox>
//Here you can use your validator ..
<asp:RequiredFieldValidator runat="server" id="reqName" controltovalidate="TextBox1" errormessage="Please enter your name!" />
        <asp:Label ID="Label1" runat="server"
            Text='<%# Bind("FirstName") %>'></asp:Label>
Thanks to everyone for their replies.

FYI: The link looked very promising but the article was from back in 2006-2007. I contacted the author, Scott Mitchell, to ask if the series of articles was still relevant. I'm sharing his reply here:

"Hi Christian. I wouldn’t recommend using Typed DataSets, which is the technology my tutorials detailed. It’s a defunct technology at this point.

Instead, I’d recommend using either Linq-to-SQL or Entity Framework. Scott Guthrie has a multi-part tutorial on using Linq-to-SQL:


Thought I’d share this.  BTW, when I tried to convert from BoundFields to TemplateFields, as Akii suggested and Mr. Mitchell’s tutorial demonstrated, I wound up with DynamicData tags instead, so the RequiredFieldValidator still didn’t work.

Back to the drawing board …


Hi Christian,

According to your description, you are have using the DynamicData tags, and you want to validate it.

If so, please refer to the following code:

<%@ Page Language="C#" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">

<script runat="server">
  protected void Page_Init(object sender, EventArgs e)

<html xmlns="">
<head runat="server">
  <title>DynamicField Sample</title>
  <link href="~/Site.css" rel="stylesheet" type="text/css" />
  <form id="form1" runat="server">

      <h2><%= CustomersDataSource.TableName%> Table</h2>

      <asp:DynamicDataManager ID="DynamicDataManager1" runat="server"
        AutoLoadForeignKeys="true" />

      <asp:ValidationSummary ID="ValidationSummary1" runat="server" EnableClientScript="true"
        HeaderText="List of validation errors"  />
      <asp:DynamicValidator runat="server" ID="DynamicValidator1"
        ControlToValidate="CustomersGridView" Display="None" />

      <asp:GridView ID="CustomersGridView" runat="server"
          <asp:DynamicField DataField="CustomerID" />
          <asp:DynamicField DataField="FirstName" />
          <asp:DynamicField DataField="LastName" />

      <!-- This example uses Microsoft SQL Server and connects   -->
      <!-- to the AdventureWorksLT sample database.              -->
      <asp:LinqDataSource ID="CustomersDataSource" runat="server"
        EnableDelete="true" >


There have a tutorial about validation control in gridview, please try to refer to it:

Hope it helps.

If it can’t help you, please post your sample code to here, maybe somebody can help you.

Best Regards,
Terry Guo

[RESOLVED]vs2010 toolbox controls

I am working as a beginner in vs2010 for 4.0.I see  controls such as Dynamiccontrol,Dynamicdatamanager.

I wanted to work with it but could not get good example on it and I saw Pressbook but not available.could suggest

link for getting good examples on it.Thanks in advance

well I did go through ,got other useful material but not

the one I wanted for dynamiccontrol control and dynamicdatamanager control of toolbox.

sorry I did not get my answer.

Hi srm


am working as a beginner in vs2010 for 4.0.I see  controls such as Dynamiccontrol,Dynamicdatamanager.

You could get detailed information about

If you want to learn other controls in the toolbox, you could search in
, you will get detailed information about them.

hope it helps you,