Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

required field validator not canceling update in listview edititemtemp 1

Status
Not open for further replies.

jordanking

Programmer
Sep 8, 2005
351
hello,

I have a required field validator (rfvFeatureTitle) and a validation summary inside of the edit item template in a listview control. When the text box that is being validted is empty, the error text will appear next to the text box, but it will not stop the update action of the listview control. Therefore the page throws an error about the undelying table not being able to have nulls in the given field.

The listview has a LINQ data source to a sql table.

here is the code for the aspx page:
Code:
<EditItemTemplate>
                <asp:HiddenField ID="hfPromoID" runat="server" Value='<%# Bind("intPromoID") %>' />
                <asp:ValidationSummary ID="vsFeatureEdit" runat="server" ValidationGroup="FeatureEdit" />
                <div class="Promo_Edit_Title">
                Featured Product Title: 
                <asp:TextBox ID="chrTitleEdit" runat="server" Width="150" Text='<%# Bind("chrTitle") %>' />
                    <asp:RequiredFieldValidator ID="rfvFeatureTitle" runat="server" ErrorMessage="Please Enter a Title" ControlToValidate="chrTitleEdit" Text="*" ValidationGroup="FeatureEdit"></asp:RequiredFieldValidator>    
                </div>
                <br />
                <div class="floatLeft">
                    <asp:Image ID="img_promo1" runat="server" CssClass="Promo_img" ImageUrl='<%# "~/Gallery/Promo/" + Eval("chrPicURL") %>' />                                
                    <br />
                    Priority:
                    <asp:TextBox ID="intPriorityTextBox" runat="server" Width="20px" 
                        Text='<%# Bind("intPriority") %>' />
                    <br />  <br />                   
                    Teaser:
                    <asp:TextBox ID="chrTeaserTextBox" runat="server" Width="450px"
                        Text='<%# Bind("chrTeaser") %>' />
                    <br /><br />
                    Full Description:
                    <asp:TextBox ID="chrDescriptionTextBox" runat="server" TextMode="MultiLine"  Width="600px" Height="100px"
                        Text='<%# Bind("chrDescription") %>' />
                    <br /><br />                               
                </div>
                
                <div class="Promo_Bottom">
                    <asp:Button ID="UpdateButton" runat="server" CommandName="Update" 
                        Text="Update" />
                    <asp:Button ID="CancelButton" runat="server" CommandName="Cancel" 
                        Text="Cancel" />

                </div>
                <br />
                <br />
            </EditItemTemplate>

can anyone tell me why the update action still occurs and the validation summary shows nothing

any help is greatly appreciated

.....
I'd rather be surfing
 
thanks jbenson,

an obvious oversight, after the fact that is. Works now

.....
I'd rather be surfing
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top