How do I get the validation not to fire if I'm updating a gridview on
the page. When I try to update the item in the gridview the text box
won't allow me to update because of its validation set for that text
box. How do I get around this I need the validation on the text box
too. Here's my page.
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1"
Runat="Server">
<center style="color: #006666">
<strong><span style="font-family: Arial; text-decoration:
underline">
Add a Topic</span></strong></center>
<center>
<asp:Label ID="Lbloutcome1" runat="server" ForeColor="Red"></
asp:Label> </center>
<center>
<asp:TextBox ID="TopicTxt" runat="server" TextMode="MultiLine"
Width="334px" EnableViewState="False" CausesValidation="True"></
asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator1"
runat="server" ControlToValidate="TopicTxt"
ErrorMessage="Enter a Topic">
*</asp:RequiredFieldValidator><br />
<asp:Label ID="LblMsg" runat="server"></asp:Label><br />
<asp:ValidationSummary ID="ValidationSummary1" runat="server" /
>
<br />
<asp:Button ID="Button1" runat="server" Text="Submit" />
<asp:Button ID="Button2" runat="server" Text="Reset"
CausesValidation="False" />
<br />
<br />
<asp:Label ID="Lbloutcome" runat="server" ForeColor="Red"
Width="237px"></asp:Label><br />
<asp:Label ID="Lbloutcome3" runat="server" ForeColor="Red"></
asp:Label><br />
<asp:GridView ID="GridView1" runat="server"
AutoGenerateColumns="False" DataKeyNames="classificationid"
DataSourceID="TopicsSqlDataSource"
AutoGenerateEditButton="True" BorderColor="#8E7953" BorderWidth="1px"
Width="209px" EnableViewState="False">
<Columns>
<asp:TemplateField HeaderText="Topic"
SortExpression="description">
<EditItemTemplate>
<asp:TextBox ID="TextBox1" runat="server"
Text='<%# Bind("description") %>' Height="46px" Width="239px"></
asp:TextBox>
</EditItemTemplate>
<ItemTemplate>
<asp:Label ID="Label1" runat="server" Text='<
%# Bind("description") %>'></asp:Label>
</ItemTemplate>
<ItemStyle BorderColor="#8E7953"
BorderStyle="Solid" />
<HeaderStyle BorderColor="#8E7953" Font-
Bold="True" Font-Size="Large" ForeColor="#006666" />
</asp:TemplateField>
<asp:TemplateField HeaderText="Delete Topic"
InsertVisible="False" SortExpression="classificationid">
<ItemTemplate>
<asp:Label ID="classificationid"
runat="server" Font-Bold="True" Text='<%# DataBinder.Eval
(Container.DataItem, "classificationID") %>'
Visible="False"></asp:Label>
<asp:CheckBox ID="deleteRec" runat="server"
Font-Bold="True" />
</ItemTemplate>
<ItemStyle BorderColor="#8E7953" />
<HeaderStyle BorderColor="#8E7953" Font-
Bold="True" Font-Size="Large" ForeColor="#006666" />
</asp:TemplateField>
</Columns>
</asp:GridView>
<br />
<br />
<asp:Button ID="Button3" runat="server" Text="Delete
Topic" CausesValidation="False" /><br />
<br />
<br />
<strong><span style="font-size: 14pt; color: #006666; font-
family: Arial; text-decoration: underline">
</span></strong>
<br />
<a href="http://links.10026.com/?link=AddTitle_Description.aspx" id="AddResourceAdminLink"
runat="server">Add a Resource</a><br />
<br />
<a href="http://links.10026.com/?link=EditResoureLibrary.aspx" id="EditResourceAdminLink"
runat="server">Edit Resource Library Information</a><br />
<br />
<br />
<table>
<tr>
<td style="width: 100px">
<a href="http://links.10026.com/?link=http://philanet/">
<img alt="PhilaNet" border="0" src="http://pics.10026.com/?src=Images/
philanet_small.gif" /></a></td>
<td style="width: 175px">
<a href="http://links.10026.com/?link=ResourceLibrary.aspx"><strong><span
style="font-size: 14pt">Resource Library</span></strong></a></td>
</tr>
</table>
<br />
<asp:SqlDataSource ID="TopicsSqlDataSource"
runat="server" ConnectionString="<%$
ConnectionStrings:TrainUserConnectionStr
ing %>"
SelectCommand="GetClassifications"
SelectCommandType="StoredProcedure" UpdateCommand="UpdateTopic"
UpdateCommandType="StoredProcedure">
<UpdateParameters>
<asp:Parameter Name="classificationID" Type="Int32" />
<asp:Parameter Name="description" Type="String" />
</UpdateParameters>
</asp:SqlDataSource>
<br />
</center>
</asp:Content>Checkout the ValidationGroup property.
"JJ297" <nc297@.yahoo.com> wrote in message
news:1194986781.386224.323330@.o3g2000hsb.googlegroups.com...
> How do I get the validation not to fire if I'm updating a gridview on
> the page. When I try to update the item in the gridview the text box
> won't allow me to update because of its validation set for that text
> box. How do I get around this I need the validation on the text box
> too. Here's my page.
> <asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1"
> Runat="Server">
> <center style="color: #006666">
> <strong><span style="font-family: Arial; text-decoration:
> underline">
> Add a Topic</span></strong></center>
> <center>
> <asp:Label ID="Lbloutcome1" runat="server" ForeColor="Red"></
> asp:Label> </center>
> <center>
> <asp:TextBox ID="TopicTxt" runat="server" TextMode="MultiLine"
> Width="334px" EnableViewState="False" CausesValidation="True"></
> asp:TextBox>
> <asp:RequiredFieldValidator ID="RequiredFieldValidator1"
> runat="server" ControlToValidate="TopicTxt"
> ErrorMessage="Enter a Topic">
> *</asp:RequiredFieldValidator><br />
> <asp:Label ID="LblMsg" runat="server"></asp:Label><br />
> <asp:ValidationSummary ID="ValidationSummary1" runat="server" /
> <br />
> <asp:Button ID="Button1" runat="server" Text="Submit" />
> <asp:Button ID="Button2" runat="server" Text="Reset"
> CausesValidation="False" />
> <br />
> <br />
> <asp:Label ID="Lbloutcome" runat="server" ForeColor="Red"
> Width="237px"></asp:Label><br />
> <asp:Label ID="Lbloutcome3" runat="server" ForeColor="Red"></
> asp:Label><br />
> <asp:GridView ID="GridView1" runat="server"
> AutoGenerateColumns="False" DataKeyNames="classificationid"
> DataSourceID="TopicsSqlDataSource"
> AutoGenerateEditButton="True" BorderColor="#8E7953" BorderWidth="1px"
> Width="209px" EnableViewState="False">
> <Columns>
> <asp:TemplateField HeaderText="Topic"
> SortExpression="description">
> <EditItemTemplate>
> <asp:TextBox ID="TextBox1" runat="server"
> Text='<%# Bind("description") %>' Height="46px" Width="239px"></
> asp:TextBox>
> </EditItemTemplate>
> <ItemTemplate>
> <asp:Label ID="Label1" runat="server" Text='<
> %# Bind("description") %>'></asp:Label>
> </ItemTemplate>
> <ItemStyle BorderColor="#8E7953"
> BorderStyle="Solid" />
> <HeaderStyle BorderColor="#8E7953" Font-
> Bold="True" Font-Size="Large" ForeColor="#006666" />
> </asp:TemplateField>
> <asp:TemplateField HeaderText="Delete Topic"
> InsertVisible="False" SortExpression="classificationid">
> <ItemTemplate>
> <asp:Label ID="classificationid"
> runat="server" Font-Bold="True" Text='<%# DataBinder.Eval
> (Container.DataItem, "classificationID") %>'
> Visible="False"></asp:Label>
> <asp:CheckBox ID="deleteRec" runat="server"
> Font-Bold="True" />
> </ItemTemplate>
> <ItemStyle BorderColor="#8E7953" />
> <HeaderStyle BorderColor="#8E7953" Font-
> Bold="True" Font-Size="Large" ForeColor="#006666" />
> </asp:TemplateField>
> </Columns>
> </asp:GridView>
> <br />
> <br />
> <asp:Button ID="Button3" runat="server" Text="Delete
> Topic" CausesValidation="False" /><br />
> <br />
> <br />
> <strong><span style="font-size: 14pt; color: #006666; font-
> family: Arial; text-decoration: underline">
> </span></strong>
> <br />
> <a href="http://links.10026.com/?link=AddTitle_Description.aspx" id="AddResourceAdminLink"
> runat="server">Add a Resource</a><br />
> <br />
> <a href="http://links.10026.com/?link=EditResoureLibrary.aspx" id="EditResourceAdminLink"
> runat="server">Edit Resource Library Information</a><br />
> <br />
> <br />
> <table>
> <tr>
> <td style="width: 100px">
> <a href="http://links.10026.com/?link=http://philanet/">
> <img alt="PhilaNet" border="0" src="http://pics.10026.com/?src=Images/
> philanet_small.gif" /></a></td>
> <td style="width: 175px">
> <a href="http://links.10026.com/?link=ResourceLibrary.aspx"><strong><span
> style="font-size: 14pt">Resource Library</span></strong></a></td>
> </tr>
> </table>
> <br />
> <asp:SqlDataSource ID="TopicsSqlDataSource"
> runat="server" ConnectionString="<%$
> ConnectionStrings:TrainUserConnectionStr
ing %>"
> SelectCommand="GetClassifications"
> SelectCommandType="StoredProcedure" UpdateCommand="UpdateTopic"
> UpdateCommandType="StoredProcedure">
> <UpdateParameters>
> <asp:Parameter Name="classificationID" Type="Int32" />
> <asp:Parameter Name="description" Type="String" />
> </UpdateParameters>
> </asp:SqlDataSource>
> <br />
> </center>
> </asp:Content>
>
On Nov 13, 4:02 pm, "J055" <j...@.newsgroups.nospam> wrote:
> Checkout the ValidationGroup property.
> "JJ297" <nc...@.yahoo.com> wrote in message
> news:1194986781.386224.323330@.o3g2000hsb.googlegroups.com...
>
>
>
>
> - Show quoted text -
Thanks it worked!
Subscribe to:
Post Comments (Atom)
0 comments:
Post a Comment