I am using dropdown in ASP.net to display image along with value
<asp:DropDownList ID="ddBanner" runat="server" CssClass="ddBanner" >
</asp:DropDownList>
I used the following link to modify to my needs, i got it working.
http://www.aspdotnet-suresh.com/2011/12/jquery-bind-images-to-dropdownlist-in.html
I need to get the dropdown value, which i am finding hard in my case.
when i use ddBanner.SelectedValue or ddBanner.selectedItem or ddBanner.text it gets me “1.png” while i want the “1” to store in the database, below is the value after i run the webpage
<select id="MainContent_ddBanner" class="ddBanner" name="ctl00$MainContent$ddBanner">
<option title="../ImagesBanners/1.png" value="1.png">1</option>
<option title="../ImagesBanners/2.png" value="2.png">3</option>
<option title="../ImagesBanners/3.png" value="3.png">6</option>
</select>
What should i do to get the “1” or “2” from the drop down. i also need to pre select the value store in data base when i am update the same data .
data Example:
PageTable
PageName, PageTitle, PageBannerID
Home , Welcome to our site, 1
Banner table
BannerID, BannerImage
1, 1.png
2, b.png
3, 3.png
Try