473,770 Members | 6,950 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

ImageButtons in an array

HI

In my first asp.Net Homepage I have the following problem:
There are some ImageButtons, witch ImageURL constantly changes. Now I would
like to create an array, so that I can assign the ImageURLs in a loop.

HTML:

<TR>
<TD><asp:imageb utton id="ImgBtn_1_1 " runat="server"
ImageUrl="Image _001_001.jpg"></asp:imagebutton ></TD>
<TD><asp:imageb utton id="ImgBtn_2_1 " runat="server"
ImageUrl="Image _002_001.jpg"></asp:imagebutton ></TD>
....
</TR>
<TR>
<TD><asp:imageb utton id="ImgBtn_1_2 " runat="server"
ImageUrl="Image _001_002.jpg"></asp:imagebutton ></TD>
<TD><asp:imageb utton id="ImgBtn_2_2 " runat="server"
ImageUrl="Image _002_002.jpg"></asp:imagebutton ></TD>
....
</TR>
....

ASP.Net:
// Create Array

int iColumns = 10;
int iRows = 5;

ImageButton[,] ImgBtn = new ImageButton[iColumns,iRows];
for(int y = 1; y <= iRows + 1; y++)
{
for(int x = 1; x <= iColumns + 1; x++)
{
ImgBtn[x,y] = "ImgBtn_x_y " ; // What to write instead of "ImgBtn_x_y "
?
}
}
....
Any idea?

Thanks
Nov 18 '05 #1
2 1938
In the Page_Load:

for i = 1 to x
Dim test As System.Web.UI.W ebControls.Imag eButton = New
System.Web.UI.W ebControls.Imag eButton()

test.imageurl = http://dfsfsfdsf

test.Style.Item ("Height") = 200

test.Style.Item ("Width") = 200

test.ID = "YourID" & i

AddHandler test.Command, AddressOf ImageButton_Cli ck

Panel1.Controls .Add(test)

next
Hope this helps,

Steve
"flyAway" <fl********@gmx .at> wrote in message
news:Ve******** ***********@new s.chello.at...
HI

In my first asp.Net Homepage I have the following problem:
There are some ImageButtons, witch ImageURL constantly changes. Now I would like to create an array, so that I can assign the ImageURLs in a loop.

HTML:

<TR>
<TD><asp:imageb utton id="ImgBtn_1_1 " runat="server"
ImageUrl="Image _001_001.jpg"></asp:imagebutton ></TD>
<TD><asp:imageb utton id="ImgBtn_2_1 " runat="server"
ImageUrl="Image _002_001.jpg"></asp:imagebutton ></TD>
...
</TR>
<TR>
<TD><asp:imageb utton id="ImgBtn_1_2 " runat="server"
ImageUrl="Image _001_002.jpg"></asp:imagebutton ></TD>
<TD><asp:imageb utton id="ImgBtn_2_2 " runat="server"
ImageUrl="Image _002_002.jpg"></asp:imagebutton ></TD>
...
</TR>
...

ASP.Net:
// Create Array

int iColumns = 10;
int iRows = 5;

ImageButton[,] ImgBtn = new ImageButton[iColumns,iRows];
for(int y = 1; y <= iRows + 1; y++)
{
for(int x = 1; x <= iColumns + 1; x++)
{
ImgBtn[x,y] = "ImgBtn_x_y " ; // What to write instead of "ImgBtn_x_y " ?
}
}
...
Any idea?

Thanks

Nov 18 '05 #2
I'm shure, it helps. I will try to translate is in c#
Thank You
"Steve Caliendo" <sc*******@epio n.com> schrieb im Newsbeitrag
news:#1******** ******@TK2MSFTN GP09.phx.gbl...
In the Page_Load:

for i = 1 to x
Dim test As System.Web.UI.W ebControls.Imag eButton = New
System.Web.UI.W ebControls.Imag eButton()

test.imageurl = http://dfsfsfdsf

test.Style.Item ("Height") = 200

test.Style.Item ("Width") = 200

test.ID = "YourID" & i

AddHandler test.Command, AddressOf ImageButton_Cli ck

Panel1.Controls .Add(test)

next
Hope this helps,

Steve
"flyAway" <fl********@gmx .at> wrote in message
news:Ve******** ***********@new s.chello.at...
HI

In my first asp.Net Homepage I have the following problem:
There are some ImageButtons, witch ImageURL constantly changes. Now I

would
like to create an array, so that I can assign the ImageURLs in a loop.

HTML:

<TR>
<TD><asp:imageb utton id="ImgBtn_1_1 " runat="server"
ImageUrl="Image _001_001.jpg"></asp:imagebutton ></TD>
<TD><asp:imageb utton id="ImgBtn_2_1 " runat="server"
ImageUrl="Image _002_001.jpg"></asp:imagebutton ></TD>
...
</TR>
<TR>
<TD><asp:imageb utton id="ImgBtn_1_2 " runat="server"
ImageUrl="Image _001_002.jpg"></asp:imagebutton ></TD>
<TD><asp:imageb utton id="ImgBtn_2_2 " runat="server"
ImageUrl="Image _002_002.jpg"></asp:imagebutton ></TD>
...
</TR>
...

ASP.Net:
// Create Array

int iColumns = 10;
int iRows = 5;

ImageButton[,] ImgBtn = new ImageButton[iColumns,iRows];
for(int y = 1; y <= iRows + 1; y++)
{
for(int x = 1; x <= iColumns + 1; x++)
{
ImgBtn[x,y] = "ImgBtn_x_y " ; // What to write instead of

"ImgBtn_x_y "
?
}
}
...
Any idea?

Thanks


Nov 18 '05 #3

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

Similar topics

2
575
by: Stormkid | last post by:
Hi Group I'm trying to figure out a way that I can take two (two dimensional) arrays and avShed and shed, and subtract the matching elements in shed from avShed I've pasted the arrays blow from a print_r cmd any suggestions would be great. Thanks much Todd //avShed array Array ( => Array ( => 1 => 08:00 ) => Array ( => 1 => 08:05 ) => Array ( => 1 => 08:10 ) => Array ( => 1 => 08:15 ) => Array ( => 1 => 08:20 ) => Array...
2
1487
by: Martin | last post by:
Hi, I want to use Imagebuttons () to submit a form, as following: <form ....> <Input name="buttonEdit" type=Image onclick="ActionHandle("2")> <Input name="buttonnew" type=Image onclick="ActionHandle("1")> </form> But when I click a button, the function ActionHandle is not call. I want to know, which button the user click, to open the corresponding form
3
1349
by: David P. Donahue | last post by:
This is a 2-part question: 1) I have a web form with multiple ImageButtons on it. I'd like them all to do the same thing. Basically, in english-code, the function would be as follows: Set Session variable X to the ImageURL of the button that invoked me; Forward the user to a specific URL; That code is the easy part, of course. I just need to know how to tell the ImageButtons to call that function when they're clicked. Preferably
2
1959
by: charliewest | last post by:
I am dynamically creating my datagrid, building each column in real-time via code-behind (using c#). The only way i have read to add ImageButtons to my grid dynamically is by creating a separate template class. However, a class cannot create server controls (or at least this is beyond me). I am able to create HTML <INPUT> form elements, however, these are not wired to my datagrid and hence, when clicked do not fire the datagrid's...
3
2337
by: martin | last post by:
I have a page with a imagebuttons on it - works fine on my dev machien IIS5 I ahve deployed to test server IIS6 and button does not fire at all in IE. It has rendered a html input tag. I open same page in Firefox and it does work. So is this a problem with IE or the IIS6 server/asp.net configuration? Although the same browser can browse to live site and the imagebutton works, so it must be this one IIS6 box. Which was working. What...
5
6467
by: Varangian | last post by:
ImageButton ship; ship = new ImageButton; for (int i=0; i<5; i++) { ship.ImageUrl = pathofImage; ship.ID = "ShipNo" + i.ToString(); ship.Click += new ImageClickEventHandler(this.ImageBtn_Click); this.Form1.Controls.Add(ship); }
1
1347
by: graphicsxp | last post by:
Hi, I have a few ImageButton controls on my form. One of them is the save one, on which I want the form to be submited. Other imageButtons trigger a postback, but they should not cause form validation on the client side, meaning the OnSubmit property of the Form should not be triggered. At the moment all of them trigger this property. How can I prevent that from happening ? Thanks
6
1581
by: rcoco | last post by:
Hi everyone, I'm using smilies in a datagrid so that when a user selects one smiley it is installed into sqlserver how could i go about this? The smiley is an ImageButton. Thanks
0
862
by: Gileno | last post by:
Hi! I Have a gridView with a TemplateField, with this code: <asp:TemplateField> <ItemTemplate> <img alt="Editar" src="./imagens/icon_editar.gif" /> <%# getActionStatus((int)Eval("idacesso"), (bool)Eval("bloqueado")) %> </ItemTemplate>
0
9425
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10225
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10053
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10001
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8880
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5312
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
3969
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3573
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2816
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.