frtools
asked on
Convert String to Int C#
I have a drop down list that I need to convert to an integer. Gives me an error "Input string was not in the right format" code is below.
int packID = Convert.ToInt32(DropDownLi st1.Select edValue);
int packID = Convert.ToInt32(DropDownLi
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
int packID = Convert.ToInt32(DropDownLi st2.Select edValue);
Sorry wrong DropDownList......TGIF
Sorry wrong DropDownList......TGIF
That's really strange if it is not working, I have tried your code:
-- front-code --
<asp:DropDownList ID="DropDownList2" runat="server">
<asp:ListItem>1</asp:ListI tem>
<asp:ListItem>2</asp:ListI tem>
<asp:ListItem>3</asp:ListI tem>
<asp:ListItem>4</asp:ListI tem>
<asp:ListItem>5</asp:ListI tem>
<asp:ListItem>6</asp:ListI tem>
<asp:ListItem>7</asp:ListI tem>
</asp:DropDownList>
<asp:LinkButton ID="LinkButton1" runat="server" OnClick="LinkButton1_Click ">LinkButt on</asp:Li nkButton>
-- code-behind --
protected void LinkButton1_Click(object sender, EventArgs e)
{
int packID = Convert.ToInt32(DropDownLi st2.Select edValue);
}
This is working, is there something else that is using this code?
-- front-code --
<asp:DropDownList ID="DropDownList2" runat="server">
<asp:ListItem>1</asp:ListI
<asp:ListItem>2</asp:ListI
<asp:ListItem>3</asp:ListI
<asp:ListItem>4</asp:ListI
<asp:ListItem>5</asp:ListI
<asp:ListItem>6</asp:ListI
<asp:ListItem>7</asp:ListI
</asp:DropDownList>
<asp:LinkButton ID="LinkButton1" runat="server" OnClick="LinkButton1_Click
-- code-behind --
protected void LinkButton1_Click(object sender, EventArgs e)
{
int packID = Convert.ToInt32(DropDownLi
}
This is working, is there something else that is using this code?
ASKER
<asp:DropDownList ID="DropDownList2" runat="server">
<asp:ListItem>1</asp:ListI
<asp:ListItem>2</asp:ListI
<asp:ListItem>3</asp:ListI
<asp:ListItem>4</asp:ListI
<asp:ListItem>5</asp:ListI
<asp:ListItem>6</asp:ListI
<asp:ListItem>7</asp:ListI
</asp:DropDownList>