A
alto
Hello,
I have a weird problem w/ a System.Web.UI.HtmlControls.HtmlImage control
(imgTitre in the code snippet below).
If not in a postback, I make a call to the following routine in the
Page_Load evt handler:
<code>
private void SetControls()
{
hpGoBack.Text = ((BasePage)Page).GetLocalizedText("button.GoBack");
lblNota.Text = ((BasePage)Page).GetLocalizedText("nota");
if ( Request["newsType"] != null )
{
switch ( int.Parse(Request["newsType"]) )
{
case (int)NewsGroup.Group.NewsReel :
BasePage.BuildURL( "images/titre_actualitesante.gif" );
lblNotaTxt.Text = ((BasePage)Page).GetLocalizedText("nota.NewsReel");
imgTitre.Src = BasePage.BuildURL( "images/titre_actualitesante.gif" );
break;
case (int)NewsGroup.Group.JobOffers :
lblNotaTxt.Text = ((BasePage)Page).GetLocalizedText("nota.JobOffer");
imgTitre.Src = BasePage.BuildURL( "images/titre_emploi.gif" );
break;
//default:
case (int)NewsGroup.Group.News :
lblNotaTxt.Visible = lblNota.Visible = false;
imgTitre.Src = BasePage.BuildURL( "images/titre_quoi.gif" );
break;
}
}
}
</code>
The page displays the image that imgTitre.Src points to correctly.
Next, in a button click (i.e. in a postback), I call the same routine again
and expect the same behaviour.
In the debugger I can see the value of imgTitre.Src is indeed the correct
one.
However, the end result is an empty image.
I tried replacing the HtmlImage w/ a System.Web.UI.WebControls.Image: again,
the image is empty.
It is empty even if I hardcode the path to the .gif file in the
SetControls() method above.
It only works if I hardcode the path to the .gif file in the aspx page, but
this is a nonsense, since in such a case I would have to implement 3
separate pages just to display the image statically.
So if someone has experienced something similar, please help me solve the
mystery!
TIA
I have a weird problem w/ a System.Web.UI.HtmlControls.HtmlImage control
(imgTitre in the code snippet below).
If not in a postback, I make a call to the following routine in the
Page_Load evt handler:
<code>
private void SetControls()
{
hpGoBack.Text = ((BasePage)Page).GetLocalizedText("button.GoBack");
lblNota.Text = ((BasePage)Page).GetLocalizedText("nota");
if ( Request["newsType"] != null )
{
switch ( int.Parse(Request["newsType"]) )
{
case (int)NewsGroup.Group.NewsReel :
BasePage.BuildURL( "images/titre_actualitesante.gif" );
lblNotaTxt.Text = ((BasePage)Page).GetLocalizedText("nota.NewsReel");
imgTitre.Src = BasePage.BuildURL( "images/titre_actualitesante.gif" );
break;
case (int)NewsGroup.Group.JobOffers :
lblNotaTxt.Text = ((BasePage)Page).GetLocalizedText("nota.JobOffer");
imgTitre.Src = BasePage.BuildURL( "images/titre_emploi.gif" );
break;
//default:
case (int)NewsGroup.Group.News :
lblNotaTxt.Visible = lblNota.Visible = false;
imgTitre.Src = BasePage.BuildURL( "images/titre_quoi.gif" );
break;
}
}
}
</code>
The page displays the image that imgTitre.Src points to correctly.
Next, in a button click (i.e. in a postback), I call the same routine again
and expect the same behaviour.
In the debugger I can see the value of imgTitre.Src is indeed the correct
one.
However, the end result is an empty image.
I tried replacing the HtmlImage w/ a System.Web.UI.WebControls.Image: again,
the image is empty.
It is empty even if I hardcode the path to the .gif file in the
SetControls() method above.
It only works if I hardcode the path to the .gif file in the aspx page, but
this is a nonsense, since in such a case I would have to implement 3
separate pages just to display the image statically.
So if someone has experienced something similar, please help me solve the
mystery!
TIA