B
Bruce
Although I have quite a bit of WinForms experience, I am new to ASP.NET. So
don't be surprised by the elementary question.
I am creating a webpage with a dropdown list that allows the user to select
an image from the list. Based on that feedback, the page calls a web service
to grab the requested image (based on an index from the dropdown) and place
it on the local file system. Then it is supposed to update the Image
control on the page by assigning a new path (via the ImageURL method on the
control). But the new image is never rendered. See code snip below.
I verified that the file accessed from the web service was actually placed
in its target location.
Is there some equivalent operation to the "invalidation " of a control that
is done in WinForms to force a redraw? Else, what else might I be missing?
Thanks, Bruce
-----------------------------------------------------------------
protected void ButtonShowImage_Click(object sender, EventArgs e)
{
long index;
byte[] bytes;
index = Convert.ToInt64( DropDownList.SelectedItem.ToString());
asset = m_ServerOld.GetAssetElements(index);
bytes = asset.fileImage;
string fullPath = @"c:\temp\" + asset.originatorName;
string fileSpec = fullPath + @"\" + asset.fileName;
DirectoryInfo target = new DirectoryInfo(fullPath);
if (!target.Exists) target.Create();
using (FileStream fs = new FileStream(fileSpec, FileMode.Create,
FileAccess.Write))
{
fs.Write(bytes, 0, bytes.Length);
}
// ImageBox.ResolveUrl(fileSpec);
ImageBox.ImageUrl = fileSpec;
}
don't be surprised by the elementary question.
I am creating a webpage with a dropdown list that allows the user to select
an image from the list. Based on that feedback, the page calls a web service
to grab the requested image (based on an index from the dropdown) and place
it on the local file system. Then it is supposed to update the Image
control on the page by assigning a new path (via the ImageURL method on the
control). But the new image is never rendered. See code snip below.
I verified that the file accessed from the web service was actually placed
in its target location.
Is there some equivalent operation to the "invalidation " of a control that
is done in WinForms to force a redraw? Else, what else might I be missing?
Thanks, Bruce
-----------------------------------------------------------------
protected void ButtonShowImage_Click(object sender, EventArgs e)
{
long index;
byte[] bytes;
index = Convert.ToInt64( DropDownList.SelectedItem.ToString());
asset = m_ServerOld.GetAssetElements(index);
bytes = asset.fileImage;
string fullPath = @"c:\temp\" + asset.originatorName;
string fileSpec = fullPath + @"\" + asset.fileName;
DirectoryInfo target = new DirectoryInfo(fullPath);
if (!target.Exists) target.Create();
using (FileStream fs = new FileStream(fileSpec, FileMode.Create,
FileAccess.Write))
{
fs.Write(bytes, 0, bytes.Length);
}
// ImageBox.ResolveUrl(fileSpec);
ImageBox.ImageUrl = fileSpec;
}