Solved

GridView Update command and checking values

Posted on 2006-11-02
2
224 Views
Last Modified: 2008-01-09
How do I make sure the right values are entered when updating from the GridView? Is there a way to error check?
0
Comment
Question by:HangTenDesign
2 Comments
 
LVL 5

Accepted Solution

by:
hfpon earned 250 total points
ID: 17864577
Convert your boundfields into templatefields;
then put validation control to the textboxes and set those validation control display as dynamic.
For example;

            <asp:TemplateField HeaderText="Effect" SortExpression="sEffect" >
                <EditItemTemplate>
                    <asp:TextBox ID="TextBox2" runat="server" Height="50px" Text='<%# Bind("sEffect") %>'
                        TextMode="MultiLine" Width="150px"></asp:TextBox>
                    <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ControlToValidate="TextBox2"
                        Display="Dynamic" ErrorMessage="RequiredFieldValidator"></asp:RequiredFieldValidator>
                </EditItemTemplate>
                <ItemTemplate>
                    <asp:Label ID="Label2" runat="server" Text='<%# Bind("sEffect") %>' Width="150px"></asp:Label>
                </ItemTemplate>
0
 

Author Comment

by:HangTenDesign
ID: 17867881
Hi, this is very good but not giving me the desired result. Is there any way to wire a client side javascript function. I manager to put a OnClientClick on the EditTemplate UpdateCommand button but I don't know how to predict the DOM reference of the renderend text box inside the GridView.

Maybe there is another way to do Client side error check and alert box.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Need an intro to -- .Net SQL Authorization Manager 7 79
Error in page 3 46
ASP.NET 5 Templates 2 66
C#  Radio button search for Date not DateTime 4 35
ASP.Net to Oracle Connectivity Recently I had to develop an ASP.NET application connecting to an Oracle database.As I am doing it first time ,I had to solve several problems. This article will help to such developers  to develop an ASP.NET client…
Problem Hi all,    While many today have fast Internet connection, there are many still who do not, or are connecting through devices with a slower connect, so light web pages and fast load times are still popular.    If your ASP.NET page …
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
Both in life and business – not all partnerships are created equal. As the demand for cloud services increases, so do the number of self-proclaimed cloud partners. Asking the right questions up front in the partnership, will enable both parties …

920 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now