Click here to Skip to main content
11,410,750 members (64,021 online)
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C#
Hi
I added a dropdown list to createuserwizard.

in the source i added following code

<tr>
                            <td align="right">
                                <asp:Label ID="Application" runat="server" AssociatedControlID="Application">Application:</asp:Label>
                            </td>
                            <td>
                                <asp:DropDownList ID="DropDownList1" runat="server" BackColor="#9999FF" Font-Bold="False" Font-Italic="True" Font-Names="Tahoma" Font-Size="Larger" ForeColor="White">
                                    <asp:ListItem>----SELECT VALUE----</asp:ListItem>
                                    <asp:ListItem>CRX</asp:ListItem>
                                    <asp:ListItem>QA</asp:ListItem>
                                    <asp:ListItem>MFDL</asp:ListItem>
                                    <asp:ListItem>DMS</asp:ListItem>
                                    <asp:ListItem>CPGN</asp:ListItem>
                                    <asp:ListItem>INFOVIEW</asp:ListItem>
                                </asp:DropDownList>
                                &nbsp;&nbsp;
                                <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server"
                                    ControlToValidate="DropDownList1"
                                    ErrorMessage="Application should be selected." Font-Size="Larger"
                                    ToolTip="Application should be selected." ValidationGroup="CreateUserWizard1">*</asp:RequiredFieldValidator>
 
                            </td>
                        </tr>

Now the problem is how to retrive the selected valu in dropdownlist

I was trying to send that value to a string as below

string abc = CreateUserWizard1.Dropdownlist1;(I am not getting dropdownlist from the list CreateUserWizard1.----
Posted 26-Jun-13 5:24am

1 solution

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

this is the syntax to retrive the selected value in dropdown list that was added.
 
string sel = ((DropDownList)CreateUserWizard1.CreateUserStep.ContentTemplateContainer.FindControl("DropDownList1")).SelectedItem.Text.Trim();
  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 Sergey Alexandrovich Kryukov 239
1 Sascha Lefévre 85
2 Dave Kreskowiak 80
3 Maciej Los 68
4 RyanDev 50
0 Sergey Alexandrovich Kryukov 8,885
1 OriginalGriff 6,915
2 Maciej Los 3,390
3 Abhinav S 3,248
4 Peter Leow 3,059


Advertise | Privacy | Mobile
Web02 | 2.8.150414.5 | Last Updated 27 Jun 2013
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100