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

c# webpart question, arrays of objects

This is mainly a sharepoint webpart development issue but after 4 days
of posting I haven't had even one answer so I figured I'd post here and
see if anyone might spot something. There might be something in
creating an array of objects I've missed or maybe someone in the group
has done some sharepoint development so, here goes.

I'm attempting to add an array of linkbutton items to a webpart, the
items get added, show on the page, but the click event of the buttons
never gets called.

Adding a single link, not in an array works just fine.

Whats the difference? And why wont the array eventhandler get called?

here's the code bit:

protected LinkButton[] codeIDLinks = new LinkButton[20]; <--real
protected LinkButton link = new LinkButton(); <--test one

// the real one i'm attempting
for(int i=0;i<codeIDLinks.Length;++i) {
codeIDLinks[i] = new LinkButton();
codeIDLinks[i].Command += new CommandEventHandler(this.LTCCommand);
codeIDLinks[i].Text = i.ToString(); <--this works and shows the #'s 1-20
Controls.Add(codeIDLinks[i]); // adds the control to sharepoint
}

// the test one, this works
link.Command += new CommandEventHandler(link_Command);
link.Text = "Text";
link.ID = "Text1";
Controls.Add(link);

The array version works, shows the #'s 1-20 and makes them links
complete with javascript postback (LEFT$....) but the click event
*never* gets called. The single declaration one works just fine.

So, do I have to make 20 of these damm link buttons manually and 20
assignments or am I missing some galactic thing in sharepoint using
arrays like this?
Nov 16 '05 #1
0 2258

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

Similar topics

0
by: J. Jespersen | last post by:
Hi people, I fiddling with webparts, and have created my own custom webpart from scratch. The webpart itself is contained in a myPart.dll I have two different sites. SiteA and SiteB. Both are...
21
by: yeti349 | last post by:
Hi, I'm using the following code to retrieve data from an xml file and populate a javascript array. The data is then displayed in html table form. I would like to then be able to sort by each...
3
by: DexHex | last post by:
Hi, I am stumpt. Is there anyway to set the background image on a webpart title?
2
by: Mats Lycken | last post by:
Hi, I have a question about webparts in master pages. If I add a webpart to a webpartzone located in a master page will that webpart be available to all .aspx pages that uses that master page or...
0
by: lu2vik | last post by:
Hello, I would have a question about webpart parameters. Where are they stored when I close or minimize a webpart ?? And which tables are used to webpart with the tools aspnet_regsql.exe ?...
3
by: Jav | last post by:
I create a UserControl (.ascx), and then change it in code to: Inherits System.Web.UI.WebControls.WebParts.WebPart expecting that it will now be treated as a WebPart. But this immediately...
7
by: heddy | last post by:
I have an array of objects. When I use Array.Resize<T>(ref Object,int Newsize); and the newsize is smaller then what the array was previously, are the resources allocated to the objects that are...
14
by: ablock | last post by:
I have an array to which i have a added a method called contains. I would like to transverse this array using for...in...I understand fully that for...in is really meant for Objects and not Arrays,...
4
by: Arnab das | last post by:
I am working in asp.net webpart.I want to show the delete warning message in a modal popup. How can I achieve this?
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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:
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: 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:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.