TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Abdalla Elawad
NA
1k
215.2k
DropDownList5' has a SelectedValue which is invalid
Apr 23 2017 4:55 AM
Hi Guys
please help me
i use girideview when i update data the dropdownlist of City update null in the value and not display as data bind value
below the code
<asp:TemplateField HeaderText="City" SortExpression="City">
<EditItemTemplate>
<asp:DropDownList ID="DropDownList5" runat="server" AutoPostBack="True"
DataSourceID="SqlDataSource2" DataTextField="City" DataValueField="City"
Width="90" Font-Size="Small" Font-Names="Calibri" >
<asp:ListItem>Selected City</asp:ListItem>
</asp:DropDownList>
<asp:SqlDataSource ID="SqlDataSource2" runat="server"
ConnectionString="<%$ ConnectionStrings:Cash_PlanConn %>"
SelectCommand="SELECT City FROM RegionCity2 WHERE (Region = @Region)">
<SelectParameters>
<asp:ControlParameter ControlID="DropDownList6" Name="Region"
PropertyName="SelectedValue" Type="String" />
</SelectParameters>
</asp:SqlDataSource>
<asp:RequiredFieldValidator ID="rfvEditCity" runat="server" ErrorMessage="City Is Required"
ControlToValidate="DropDownList5" Text="*Required" ForeColor="Red"></asp:RequiredFieldValidator>
</EditItemTemplate>
<ItemTemplate>
<asp:Label ID="Label14" runat="server" Text='<%# Bind("City") %>'></asp:Label>
</ItemTemplate>
<FooterTemplate>
<asp:DropDownList ID="dd_City" runat="server" AutoPostBack="True"
DataSourceID="SqlDataSource3" DataTextField="City" DataValueField="City"
Width="90" Font-Size="Small" Font-Names="Calibri">
<asp:ListItem>Selected City</asp:ListItem>
</asp:DropDownList>
<asp:SqlDataSource ID="SqlDataSource3" runat="server"
ConnectionString="<%$ ConnectionStrings:Cash_PlanConn %>"
SelectCommand="SELECT City FROM RegionCity2 WHERE (Region = @Region)">
<SelectParameters>
<asp:ControlParameter ControlID="dd_Region" Name="Region"
PropertyName="SelectedValue" Type="String" />
</SelectParameters>
</asp:SqlDataSource>
<asp:RequiredFieldValidator ValidationGroup="INSERT" ID="rfvInsertCity" runat="server" ErrorMessage="City Is Required"
ControlToValidate="dd_City" Text="*Required" ForeColor="Red"></asp:RequiredFieldValidator>
</FooterTemplate>
</asp:TemplateField>
ERROR :
Grid View:
Reply
Answers (
5
)
give custom validation in controller action method in aspmvc
How to delete rows of two different table having same id mvc