Hi Folks,
Have a weird ask.
I have 4 sections in a web page, out of which one section is an image.
A SQL table having 5 columns is prepared, corresponding to the 4 sections of the web page.
Even the image name is stored in one of the column of the table.
My requirement is how to apply the image name from the SQL table to the actual image inserted in the code.
Below is my table structure:
ErrorCode Section1 Section2 Section3 Section4
1001 Sorry You don't have access Pic1.jpg Contact HelpDesk
And here is my front end stuffs:
<div id="First">
<asp:Label ID="Section1" runat="server" CssClass="FirstLabelStyle">
</asp:Label>
</div>
<div id="Second">
<asp:Label ID="Section2" runat="server" CssClass="NewerLabelStyle">
</asp:Label>
</div>
<div id="Third">
<asp:Image ID="FirstImage" ImageUrl="~/Images/RequestAccess.png" runat="server" />
</div>
<div id="Fourth">
<asp:Label ID="Section4" runat="server" CssClass="NewerLabelStyle">
</asp:Label>
</div>
Below is my C# code:
protected void Page_Load(object sender, EventArgs e)
{
if (!string.IsNullOrEmpty(Request.QueryString["ErrorCode"]))
{
int errorcode = Convert.ToInt32(Request.QueryString["ErrorCode"]);
DataTable dtErrorPage = DomainBL.GetData("ErrorPage");
if (errorcode == 1001)
{
Section1.Text = dtErrorPage.Rows[0][1].ToString();
Section2.Text = dtErrorPage.Rows[0][2].ToString();
Section4.Text = dtErrorPage.Rows[0][4].ToString();
}
}
}
I guess I have made my question clear. I just wana know how to apply the name of the
image as 'Pic1.jpg' so that when its deployed in the server, IIS retains the same name.
I know I m missing something, not able to re-collect it.
Any pointers will be highly appreicated.
-Anurag