473,386 Members | 1,785 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,386 software developers and data experts.

Combine variable and #bind

I have a DataList that displays photos and is bound to a list of files. Is
there a way to combine the value of a variable (strpath) with the #
Bind(...) in the ImageURL field. Below is what I have now.

<asp:ImageButton ID="ImgBtn1" runat="server"

CausesValidation="false" CommandName="Select"

AlternateText='<%# Bind("Name") %>'

ImageUrl='<%# Bind("FullName") %>'

CommandArgument='<%# Bind("FullName") %>'

OnClientClick="return showpic(this);"

OnCommand="ImgBtn1_Command" Height="100" Width="150" />

I would like to add the value of strpath to the # Bind("FullName").
Thanks.

David
Jun 21 '07 #1
1 2378
Good morning David,

Yes there is. You just need to expose strpath as page class property (or
simply as protected variable)

-- aspx page code --

<asp:ImageButton ID="ImgBtn1" runat="server"
CausesValidation="false" CommandName="Select"
AlternateText='<%# Eval("Name") %>'
ImageUrl='<%# Eval("FullName") %>'
CommandArgument='<%# ImageDirPath + Bind("FullName") %>'
OnClientClick="return showpic(this);"
OnCommand="ImgBtn1_Command" Height="100" Width="150" />

-- end aspx page code --

-- code behind/beside

protected string ImageDirPath
{
get
{
return "~/Images/";
}
}

-- end code behind/beside

Note I used Eval() instead of Bind() because (in this case) you're not
getting the value back from the control.

hope this helps
--
Milosz
"David C" wrote:
I have a DataList that displays photos and is bound to a list of files. Is
there a way to combine the value of a variable (strpath) with the #
Bind(...) in the ImageURL field. Below is what I have now.

<asp:ImageButton ID="ImgBtn1" runat="server"

CausesValidation="false" CommandName="Select"

AlternateText='<%# Bind("Name") %>'

ImageUrl='<%# Bind("FullName") %>'

CommandArgument='<%# Bind("FullName") %>'

OnClientClick="return showpic(this);"

OnCommand="ImgBtn1_Command" Height="100" Width="150" />

I would like to add the value of strpath to the # Bind("FullName").
Thanks.

David
Jun 22 '07 #2

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

Similar topics

1
by: Tao | last post by:
I am newbie to C#. Here is a question: I want to bind a variable in my class to a control. I got tons of troubles to do so. Can somebody give me quick sample in C#(not VB) please. Thanks.
1
by: pjbates | last post by:
Hi, I've been using the GridView and DetailsView controls for a while, and I'm beginning to get annoyed by the redundancy of EditItemTemplate and InsertItemTemplate in many cases. In the...
1
by: k_mahesh7 | last post by:
I need tp bind a variable to a select and send to oracle database. I have the value to be send in a variable but that variable to be binded to the query as the database I an hitting is a siebel...
3
by: Dabbler | last post by:
I have a Gridview ItemTemplate which displays company info as follows <ItemTemplate> <asp:Label ID="WEmployerLabel" runat="server" Text='<%# Bind("Employer") %>'></asp:Label><br /> <asp:Label...
12
by: Monty | last post by:
Hope this is an easy one: How can I bind a text on a form to a an integer variable? Possible? Thanks!
2
by: DanWeaver | last post by:
I am assigning a profile variable based on the conents of a text box when a button is pressed- this is then used as a search term to populate a list box- all controls are in same ajax update panel-...
1
pbmods
by: pbmods | last post by:
VARIABLE SCOPE IN JAVASCRIPT LEVEL: BEGINNER/INTERMEDIATE (INTERMEDIATE STUFF IN ) PREREQS: VARIABLES First off, what the heck is 'scope' (the kind that doesn't help kill the germs that cause...
2
by: niskin | last post by:
Hi I want to combine these variables: char computera; //this variable contains input from the user char path= "\\\\"; char location = "\\C$\\Windows\\System32\\chat.txt"; The order I want...
37
by: minkoo.seo | last post by:
Hi. I've got a question on the differences and how to define static and class variables. AFAIK, class methods are the ones which receives the class itself as an argument, while static methods...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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: 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
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
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...

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.