Click here to Skip to main content
15,896,063 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
This is my code.
Even after giving imageurl to both image controls...I am getting an exception of imageurl is required.
stuck up on this.
Plz help.
THanks.




C#
HiddenField hdnPriority = (e.Row.Items[1].FindControl(Constants.HiddenFieldPriority) as HiddenField);
                HiddenField hdnRead = (e.Row.Items[2].FindControl(Constants.HiddenFieldRead) as HiddenField);
                Image imgRead = null;
                imgRead = (e.Row.Items[2].FindControl(Constants.ImageRead) as Image);
                Image imgPriority = null;
                imgPriority = (e.Row.Items[1].FindControl(Constants.ImagePriority) as Image);

                ////Bold Unbold Logic.
                if (hdnPriority.Value.ToString() != Constants.High && hdnRead.Value.ToString() == String.Empty && lstMail.SelectedIndex != 1)
                {
                    e.Row.CssClass = Constants.Bold_Font;

                    imgRead.Visible = true;
                    imgRead.ImageUrl = "~/Images/IsNew.jpg";
                    imgPriority.Visible = true;
                    imgPriority.ImageUrl = "~/Images/Transparent.jpg";


                }

                else if (hdnPriority.Value.ToString() != Constants.High && hdnRead.Value.ToString() != String.Empty && lstMail.SelectedIndex != 1)
                {
                    e.Row.CssClass = Constants.UnBold_Font;

                    imgRead.Visible = true;
                    imgRead.ImageUrl = "~/Images/IsOpen.png";

                    imgPriority.Visible = true;
                    imgPriority.ImageUrl = "~/Images/Transparent.jpg";


                }

                ////Bold Unbold Logic For High Priority Email.
                else if (hdnPriority.Value.ToString() == Constants.High && hdnRead.Value.ToString() == String.Empty && lstMail.SelectedIndex != 1)
                {
                    e.Row.CssClass = Constants.Bold_High_Font;

                    imgPriority.Visible = true;
                    imgPriority.ImageUrl = "~/Images/High.png";


                    imgRead.Visible = true;
                    imgRead.ImageUrl = "~/Images/IsNew.jpg";

                }

                else if (hdnPriority.Value.ToString() == Constants.High && hdnRead.Value.ToString() != String.Empty && lstMail.SelectedIndex != 1)
                {
                    e.Row.CssClass = Constants.UnBold_High_Font;

                    imgPriority.Visible = true;
                    imgPriority.ImageUrl = "~/Images/High.png";


                    imgRead.Visible = true;
                    imgRead.ImageUrl = "~/Images/IsOpen.png";

                }
Posted
Updated 16-Jan-14 17:24pm
v2
Comments
Prasaad SJ 17-Jan-14 0:02am    
Did you debug and check that it is going to any of the If statement that you use?
aks.shan 17-Jan-14 3:53am    
I am using WebDatagrid on my page .
I have a template column and in that template field I have an item template which is an image control and has a default url "~/Images/Blue.jpg".

I am changing this image url in OnInitializeRow event of the grid.

I also have another template column with a link button as item template.

The issue is that whenever I click on the link button..the grid causes a postback and the image control gets the default url. :(

How can I resolve this issue.

Thanks
-Akshay

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900