Click here to Skip to main content
15,910,981 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
How to Pass value of dropdown to the function as paramete

my code is

C#
protected void PayWithPayPal(string amount, string itemInfo, string name,
         string phone, string email, string currency)



and i am passsing value like this


C#
protected void btnPay_AsPerYourChoice(object sender, EventArgs e)
   {
       PayWithPayPal(txtAmount,txtPurpose,txtName,txtPhone,txtEmailId,ToString().(ddlCurrency.SelectedItem));
   }


Dropdown code is

XML
<asp:DropDownList runat="server" ID="ddlCurrency" Style="margin-left: 42px;
        width: 204px; background-image: transparent url('../images/txtBoxbg.jpg') no-repeat;">
        <asp:ListItem>- Select -</asp:ListItem>
        <asp:ListItem>INR</asp:ListItem>
        <asp:ListItem>USD</asp:ListItem>
        <asp:ListItem>EURO</asp:ListItem>
        <asp:ListItem>Pound</asp:ListItem>
    </asp:DropDownList>



Getting error
:Identifier Required
Posted
Comments
Timberbird 21-Oct-13 4:16am    
Have you tried using .SelectedValue property instead of .SelectedItem?

1 solution

Try this way -
C#
PayWithPayPal(txtAmount.Text,txtPurpose.Text,txtName.Text,txtPhone.Text,txtEmailId.Text,ddlCurrency.SelectedItem.Text)
 
Share this answer
 
Comments
Member 10310320 21-Oct-13 4:25am    
thanks

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900