Quantcast
Channel: VBForums - Visual Basic .NET
Viewing all articles
Browse latest Browse all 27254

Evaluating each ImageUrl in a table and setting it's value/path conditionally

$
0
0
Greetings,

I'm about to write some code whereby a user will be able to:

  • check some checkboxes on a page
  • open a new print page via a print button
  • select a print button on the new print page to finally print the page


I have two jpeg files - one of an unchecked checkbox and one of a checked checkbox.
I will default the ImageUrl attribute of each Image control to the path of the unchecked jpeg.
Then I would like to evaluate each checkbox that the user may or may not have checked and re-set the corresponding ImageUrl in the table tblHolisticConcerns to the path for the checked jpeg, if of course the user has checked the corresponding checkbox.
I'm thinking I would need to do this server side, but I'm happy to do it client side if necessary, but I feel it may be easier to embed the the table in a further control. What will my code need to look like? There are about 50 checkboxes in total so can I avoid using a series of IF statements? As you can probably tell I'm not an expert in such matters, but I try my best. :) Thank you.

Code:

<table id="tblHolisticConcerns" runat="server" border="2" >             
                    <tr id="trPracticalConcerns2" runat="server">                             
                        <td style="width:20%; height:25px; vertical-align:middle"><asp:Image id="Img1" runat="server" ImageUrl="..\unchecked.jpg" />&nbsp;Child Care<asp:Literal ID="litChildCare" runat="server"></asp:Literal></td>
                        <td style="width:20%; height:25px; vertical-align:middle"><asp:Image id="Img2" runat="server" ImageUrl="..\unchecked.jpg" />&nbsp;Communication<asp:Literal ID="litCommunication" runat="server"></asp:Literal></td>
                        <td style="width:20%; height:25px; vertical-align:middle"><asp:Image id="Img3" runat="server" ImageUrl="..\unchecked.jpg" />&nbsp;Household Tasks<asp:Literal ID="litHouseholdTasks" runat="server"></asp:Literal></td>
                        <td style="width:20%; height:25px; vertical-align:middle"><asp:Image id="Img4" runat="server" ImageUrl="..\unchecked.jpg" />&nbsp;Housing<asp:Literal ID="litHousing" runat="server"></asp:Literal></td>
                        <td style="width:20%; height:25px; vertical-align:middle"><asp:Image id="Img5" runat="server" ImageUrl="..\unchecked.jpg" />&nbsp;Insurance<asp:Literal ID="litInsurance" runat="server"></asp:Literal></td>
                    </tr>
</table>


Viewing all articles
Browse latest Browse all 27254

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>