473,395 Members | 1,468 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Rebind Image Control's ImageURL on postback

Hi,
I have an image control which inside an ItemTemplate of a GridView
Control.
I've coded the ImageControl's ImageURL in "Source" to have a
dynamically filled-up value
ex: ImageURL = <%# FormatImageURL() %>
CodeBehind: private function FormatImageURL
{ DropdownlistControl.SelectedValue }

When page loads for the first time, everything is okay.
The ImageURL has the correct ImageURL , w/c is equivalent to the
DropDownListControls's default SelectedValue.

However, once I've manually change the DropDownList's selected value
in the UI,
after the page PostsBack, the ImageURL value remains the same, even
though
the DropDownListControl's SelectedValue has now been changed.

My question is now, how do I change the ImageControl's ImageURL value
whenever
I change the DropDownListControl's SelectedValue manually in the UI?

Thanks,
Henry Wu

Apr 23 '07 #1
1 2040
Grid view picks up the dropdown value only when it binds to the data source.
So, you have to bind the it again (on post back) so that it can take the new
dropdown value.

Alternatively, on post back, you can loop-through the grid rows and change
each row's image URL based on the dropdown value.

"wardemon" wrote:
Hi,
I have an image control which inside an ItemTemplate of a GridView
Control.
I've coded the ImageControl's ImageURL in "Source" to have a
dynamically filled-up value
ex: ImageURL = <%# FormatImageURL() %>
CodeBehind: private function FormatImageURL
{ DropdownlistControl.SelectedValue }

When page loads for the first time, everything is okay.
The ImageURL has the correct ImageURL , w/c is equivalent to the
DropDownListControls's default SelectedValue.

However, once I've manually change the DropDownList's selected value
in the UI,
after the page PostsBack, the ImageURL value remains the same, even
though
the DropDownListControl's SelectedValue has now been changed.

My question is now, how do I change the ImageControl's ImageURL value
whenever
I change the DropDownListControl's SelectedValue manually in the UI?

Thanks,
Henry Wu

Apr 23 '07 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Mark Kamoski | last post by:
How can one change an image url at runtime? (Note, the image exists in a user control.) This is the image tag on the ascx... <asp:image id="TopBanner" runat="server"></asp:image> ....but...
5
by: Guadala Harry | last post by:
In an aspx page I have declared an Image control: <asp:Image id="myImage" runat="server"></asp:Image> In the code-behind I populate it's ImageURL property, like this: myImage.ImageUrl =...
6
by: ruca | last post by:
Hi gurus, I have a imagebutton in my WebForm, and I want that when I click (mouse down) on her the imagebutton change image and when I "unclick" (mouse up) change to the original image. Basically...
2
by: Mango | last post by:
Hi there, I will be very happy if someone helps me. I need to create dynamic image, and save the state between the postback. I mean I've got 5 buttons and when I click on one of them, the image is...
3
by: jens.buchta | last post by:
Hi! I'm using a DataGrid with a template column to display an Image inside of it. I'm hooking into its OnPrerender-Event to set the ImageURL-Property dynamically. Everything works just fine...
1
by: tom | last post by:
Hi, I am a newbie and have a simple question? I have a aspx file and on the form I have a user control which is my header and has some images. Now for various pages I need to load different...
0
by: David | last post by:
Hello all. I am trying to implement my first server control and have run into two problems that I cannot solve. I need the assistance of someone with more experience. My goal was to create an...
2
by: CK | last post by:
Hello All, I am trying to extend the default asp:ImageButton to include an image for an enabled state and a second image for a disabled state. I currently did this by extending the ImageButton...
3
by: Nathan Sokalski | last post by:
I am using the ImageUrl property of the HyperLink control. My image is large, so I am setting the width/height attributes, but when it renders the width/height attributes are in the <atag rather...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.