string value = "";
foreach (Control ctrl in imageformat.Controls)
{
if (ctrl is RadioButtonList)
{
RadioButtonList rbl = (RadioButtonList)ctrl;
for (int i = 0; i < rbl.Items.Count; i++)
{
if (rbl.Items[i].Selected)
{
//get the text value of the selected radio button
value = rbl.Items[i].Value;
}
}
}
}
public Image stringToImage(string inputString)
{
byte[] imageBytes = Convert.FromBase64String(inputString);
MemoryStream ms = new MemoryStream(imageBytes);
Image image = Image.FromStream(ms, true, true);
return image;
}
ImageFormat img = stringToImage(value);
<asp:RadioButtonList ID="imageformat" runat="server">
<asp:ListItem Text="jpg" Value="Jpeg" />
<asp:ListItem Text="bmp" Value="Bmp" />
<asp:ListItem Text="tiff" Value="Tiff" />
<asp:ListItem Text="png" Value="Png" />
</asp:RadioButtonList>