How to store only imagefile name in database table

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • gm000
    New Member
    • Nov 2009
    • 11

    How to store only imagefile name in database table

    hi
    i m using radiobuttonlist with images like this
    Code:
    <asp:RadioButtonList ID="rbtnthumb1"   runat="server">
        <asp:ListItem  Value ="News_icon.jpg"> 
            <img src="http://bytes.com/images/News_icon.jpg" alt="News" align="absmiddle"> 
            News
        </asp:ListItem>
        <asp:ListItem  Value ="imageicon.bmp">
          <img src="http://bytes.com/images/imageicon.bmp" alt="Image" align="absmiddle">
          Image
        </asp:ListItem>
        <asp:ListItem Value ="Video97.gif" >
          <img src="http://bytes.com/images/Video97.gif" alt="Video" align="absmiddle">
          Video
        </asp:ListItem>
    </asp:RadioButtonList>
    In design view it show radiobuttonlist with images but when i use insert query.it stored this value in mytable
    Code:
    <img src="http://bytes.com/images/News_icon.jpg" alt="News" align="absmiddle"> 
    News
    but i only want to store News_icon.jpg(i mage file name)and i m using this way for adding value
    Code:
            cmd.Parameters.AddWithValue("@ChooseThumbnail", rbtnthumb1.SelectedItem.Text)
    please let me know how to store only imagefile name in database table

    regard's
    Last edited by Frinavale; Nov 11 '09, 07:31 PM. Reason: Please post code in [code] ... [/code] tags. Added code tags and indented the code for legibility.
  • Frinavale
    Recognized Expert Expert
    • Oct 2006
    • 9749

    #2
    Well, your application is doing exactly what you told it to do.

    It's taking the "Text" property of the SelectedItem... and this happens to be the HTML for the Image along with the Text that you are displaying for the item.


    What you should be using is the RadioButtonList 's SelectedValue property instead.

    Happy coding,

    -Frinny

    Comment

    • gm000
      New Member
      • Nov 2009
      • 11

      #3
      thanks

      thanks for guiding its working

      Comment

      Working...