how to validation in editmode of datagrid

How to do validation while in edit mode in datagrid...??
<asp:DataGrid ID="DataGrid1" runat="server" AutoGenerateColumns="False" DataKeyField="fid"
            OnCancelCommand="DataGrid1_CancelCommand" OnDeleteCommand="DataGrid1_DeleteCommand" OnUpdateCommand="DataGrid1_UpdateCommand"
            OnEditCommand="DataGrid1_EditCommand" 
            Style="left: 24px; position: relative; top: 94px">
            <Columns>
                <asp:TemplateColumn HeaderText="City">
                    <EditItemTemplate>
                        <asp:DropDownList ID="DropDownList1" runat="server" Style="position: relative" DataSourceID="SqlDataSource1" DataTextField="city" DataValueField="cid" >
                        </asp:DropDownList><asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:tonivtreepConnectionString2 %>"
                            SelectCommand="SELECT * FROM [citytable]"></asp:SqlDataSource>
                    </EditItemTemplate>
                    <ItemTemplate>
                       <asp:Label ID="Label1" runat="server" Style="position: relative" Text='<%# Bind("city") %>'></asp:Label>
                    </ItemTemplate>
                </asp:TemplateColumn>
                <asp:TemplateColumn HeaderText="recipe">
                    <ItemTemplate>
                        <asp:Label ID="Label2" runat="server" Style="position: relative" Text='<%# Bind("recipe") %>'></asp:Label>
                    </ItemTemplate>
                    <EditItemTemplate>
                        <asp:DropDownList ID="DropDownList2" runat="server" Style="position: relative" DataSourceID="SqlDataSource2" DataTextField="recipe" DataValueField="hid">
                        </asp:DropDownList><asp:SqlDataSource ID="SqlDataSource2" runat="server" ConnectionString="<%$ ConnectionStrings:tonivtreepConnectionString3 %>"
                            SelectCommand="SELECT [hid], [recipe] FROM [recipetable]"></asp:SqlDataSource>
                    </EditItemTemplate>
                </asp:TemplateColumn>
                <asp:TemplateColumn HeaderText="restaurant">
                    <ItemTemplate>
                        <asp:Label ID="Label3" runat="server" Style="position: relative" Text='<%# Bind("resname") %>'></asp:Label>
                    </ItemTemplate>
                    <EditItemTemplate>
                        <asp:DropDownList ID="DropDownList3" runat="server" Style="position: relative" DataSourceID="SqlDataSource3" DataTextField="resname" DataValueField="rid">
                        </asp:DropDownList><asp:SqlDataSource ID="SqlDataSource3" runat="server" ConnectionString="<%$ ConnectionStrings:tonivtreepConnectionString %>"
                            SelectCommand="SELECT [rid], [resname] FROM [resttable]"></asp:SqlDataSource>
                    </EditItemTemplate>
                </asp:TemplateColumn>
                <asp:BoundColumn DataField="fname" HeaderText="Food"></asp:BoundColumn>
                <asp:BoundColumn DataField="ftype" HeaderText="FoodType"></asp:BoundColumn>
                <asp:BoundColumn DataField="fdesc" HeaderText="Description"></asp:BoundColumn>
                <asp:BoundColumn DataField="price" HeaderText="Price"></asp:BoundColumn>
                <asp:BoundColumn DataField="quantity" HeaderText="Quantity"></asp:BoundColumn>
                <asp:EditCommandColumn CancelText="Cancel" EditText="edit" HeaderText="Update" UpdateText="Save">
                </asp:EditCommandColumn>
                <asp:ButtonColumn CommandName="Delete" Text="Delete"></asp:ButtonColumn>
            </Columns>
        </asp:DataGrid>

Open in new window

LVL 18
Rajar AhmedConsultantAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

David RobitailleAnalyst ProgrammerCommented:
just but vlaidators between the <EditItemTemplate> tacg for eatch column you whant to valiadate

 
 
Rajar AhmedConsultantAuthor Commented:
nope ,

When it turms to edit mode on clicking edit button,
The validation should occur,in all bound columns..
Right now no need for edititemtemplate..columns....
David RobitailleAnalyst ProgrammerCommented:
well, you have to trun the BoundColumn into Template to add validators.
Become a Certified Penetration Testing Engineer

This CPTE Certified Penetration Testing Engineer course covers everything you need to know about becoming a Certified Penetration Testing Engineer. Career Path: Professional roles include Ethical Hackers, Security Consultants, System Administrators, and Chief Security Officers.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
David RobitailleAnalyst ProgrammerCommented:
Why did i get a "B"
http://www.experts-exchange.com/help.jsp#hi403
"an answer is worth an A, unless it doesn't resolve your issue"
Rajar AhmedConsultantAuthor Commented:
hi, i had given the request to change it to A .I have no idea about this Grade n all . I had jst clicked something in a hurry at office .  
But really, these answer gave me some brisk thought .
Thanks for help....

David RobitailleAnalyst ProgrammerCommented:
I`m gald i could help!
David RobitailleAnalyst ProgrammerCommented:
thanks!
Rajar AhmedConsultantAuthor Commented:
ur always welcome .
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
.NET Programming

From novice to tech pro — start learning today.