synergydata
08-01-2008, 05:11 PM
I have a GridView and a DetailView on the Same Page. I call a record from the GridView, then Click Edit in the DetailsView everything works fine except I would like an Error Message to Post to the Screen when YES is selected from the DropDownList of fields Q1, Q2 or Q3. I'm missing something here because I have gotten this to work on a regular FormView before.
The ASPX Code for the Three Boxes Located in the DetailsView1
<asp:TemplateField SortExpression="CURRICULUM" HeaderText="QUESTION 1" ControlStyle-ForeColor="Black" HeaderStyle-Font-Size="Small" HeaderStyle-Font-Bold="false" HeaderStyle-VerticalAlign="Top" ItemStyle-Height="25" >
<EditItemTemplate>
<asp:DropDownList DataTextField="CURRICULUM" ID="DropDownList5" AutoPostBack="true" Runat="server" SelectedValue='<%# Bind("CURRICULUM") %>' >
<asp:ListItem Selected="true" Value=" " Text="Select One" />
<asp:ListItem Value="YES" Text="YES" />
<asp:ListItem Value="NO " Text="NO" />
</asp:DropDownList>
<div>Was this trip for CURRICULUM based training, such as Training?</div>
<asp:requiredfieldvalidator id="Requiredfieldvalidator29" ErrorMessage="REQUIRED ENTRY" BackColor="CadetBlue" runat="server" controltovalidate="DropDownList5" display="Dynamic"></asp:requiredfieldvalidator>
</EditItemTemplate>
<ItemTemplate >
<asp:Label Runat="server" Text='<%# Bind("CURRICULUM") %>' ID="CURRICULUM"></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField SortExpression="CONTINUE_ED" HeaderText="QUESTION 2" ControlStyle-ForeColor="Black" HeaderStyle-Font-Size="Small" HeaderStyle-Font-Bold="false" HeaderStyle-VerticalAlign="Top" ItemStyle-Height="25" >
<EditItemTemplate>
<asp:DropDownList DataTextField="CONTINUE_ED" ID="DropDownList6" Runat="server" SelectedValue='<%# Bind("CONTINUE_ED") %>' >
<asp:ListItem Selected="true" Value=" " Text="Select One" />
<asp:ListItem Value="YES" Text="YES" />
<asp:ListItem Value="NO " Text="NO" />
</asp:DropDownList>
<div>Was this trip for CONTINUING EDUCATION COURSES?</div>
<asp:requiredfieldvalidator id="Requiredfieldvalidator30" ErrorMessage="REQUIRED ENTRY" BackColor="CadetBlue" runat="server" controltovalidate="DropDownList6" display="Dynamic"></asp:requiredfieldvalidator>
</EditItemTemplate>
<ItemTemplate >
<asp:Label Runat="server" Text='<%# Bind("CONTINUE_ED") %>' ID="CONTINUE_ED"></asp:Label>
</ItemTemplate>
</asp:TemplateField>
Code Behind Page
Protected Sub DropDownList6_SelectedIndexChanged(ByVal sender As Object, ByVal e As EventArgs)
DetailsView1.ChangeMode(DetailsViewMode.Edit)
Dim Curriculum As String
If Curriculum Is "YES" Then
Response.write("HELLO THERE")
End If
End Sub
The ASPX Code for the Three Boxes Located in the DetailsView1
<asp:TemplateField SortExpression="CURRICULUM" HeaderText="QUESTION 1" ControlStyle-ForeColor="Black" HeaderStyle-Font-Size="Small" HeaderStyle-Font-Bold="false" HeaderStyle-VerticalAlign="Top" ItemStyle-Height="25" >
<EditItemTemplate>
<asp:DropDownList DataTextField="CURRICULUM" ID="DropDownList5" AutoPostBack="true" Runat="server" SelectedValue='<%# Bind("CURRICULUM") %>' >
<asp:ListItem Selected="true" Value=" " Text="Select One" />
<asp:ListItem Value="YES" Text="YES" />
<asp:ListItem Value="NO " Text="NO" />
</asp:DropDownList>
<div>Was this trip for CURRICULUM based training, such as Training?</div>
<asp:requiredfieldvalidator id="Requiredfieldvalidator29" ErrorMessage="REQUIRED ENTRY" BackColor="CadetBlue" runat="server" controltovalidate="DropDownList5" display="Dynamic"></asp:requiredfieldvalidator>
</EditItemTemplate>
<ItemTemplate >
<asp:Label Runat="server" Text='<%# Bind("CURRICULUM") %>' ID="CURRICULUM"></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField SortExpression="CONTINUE_ED" HeaderText="QUESTION 2" ControlStyle-ForeColor="Black" HeaderStyle-Font-Size="Small" HeaderStyle-Font-Bold="false" HeaderStyle-VerticalAlign="Top" ItemStyle-Height="25" >
<EditItemTemplate>
<asp:DropDownList DataTextField="CONTINUE_ED" ID="DropDownList6" Runat="server" SelectedValue='<%# Bind("CONTINUE_ED") %>' >
<asp:ListItem Selected="true" Value=" " Text="Select One" />
<asp:ListItem Value="YES" Text="YES" />
<asp:ListItem Value="NO " Text="NO" />
</asp:DropDownList>
<div>Was this trip for CONTINUING EDUCATION COURSES?</div>
<asp:requiredfieldvalidator id="Requiredfieldvalidator30" ErrorMessage="REQUIRED ENTRY" BackColor="CadetBlue" runat="server" controltovalidate="DropDownList6" display="Dynamic"></asp:requiredfieldvalidator>
</EditItemTemplate>
<ItemTemplate >
<asp:Label Runat="server" Text='<%# Bind("CONTINUE_ED") %>' ID="CONTINUE_ED"></asp:Label>
</ItemTemplate>
</asp:TemplateField>
Code Behind Page
Protected Sub DropDownList6_SelectedIndexChanged(ByVal sender As Object, ByVal e As EventArgs)
DetailsView1.ChangeMode(DetailsViewMode.Edit)
Dim Curriculum As String
If Curriculum Is "YES" Then
Response.write("HELLO THERE")
End If
End Sub