开发者

still not getting solution..please anyone help me? [closed]

开发者 https://www.devze.com 2023-03-05 21:41 出处:网络
It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical andcannot be reasonably answered in its current form. For help clari
It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center. Closed 11 years ago.

i hava ddl and textbox..if my text box value already exist in ddl means i should display message as already exist in ddl..

i tried compare calidator..but not working,,,

<asp:DropDownList ID="ddlmothertongue" AppendD开发者_Python百科ataBoundItems="True" runat="server"
          CssClass="dd_NoWidth" Width="136px" 
          OnSelectedIndexChanged="ddlmothertongue_SelectedIndexChanged"
          AutoPostBack="True" DataSourceID="SqlDataSource1" 
          DataTextField="mothertongue"
          DataValueField="mothertongue">
  <asp:ListItem Value="0" Text="-Select-"></asp:ListItem>
</asp:DropDownList>
<asp:SqlDataSource ID="SqlDataSource1" runat="server"
   ConnectionString="<%$ ConnectionStrings:NewMatrimonyConnectionString %>"
   SelectCommand="SELECT distinct  [mothertongue] FROM [tbl_mothertongue]union all select 'Others'"></asp:SqlDataSource>
   <asp:TextBox ID="txtmothertongue" runat="server" 
       Visible="False" AutoPostBack="True"></asp:TextBox>
<asp:TextBox ID="txtmothertongue" runat="server" Visible="False"
       AutoPostBack="True"></asp:TextBox>


Since you are not really supplying much data, I can just give you a solution with the data I have.

 if (ddl.items.Contains(value)) 
 {
       //show message it already contains item
 }
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号