Solved

GridView Update command and checking values

Posted on 2006-11-02
2
210 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

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

A quick way to get a menu to work on our website, is using the Menu control and assign it to a web.sitemap using SiteMapDataSource. Example of web.sitemap file: (CODE) Sample code to add to the page menu: (CODE) Running the application, we wi…
User art_snob (http://www.experts-exchange.com/M_6114203.html) encountered strange behavior of Android Web browser on his Mobile Web site. It took a while to find the true cause. It happens so, that the Android Web browser (at least up to OS ver. 2.…
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

707 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

18 Experts available now in Live!

Get 1:1 Help Now