473,666 Members | 2,088 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Need help with C# code

Hi, I have a form which contains a table(Table1), within that table I have
label with an ID set to "1A".
Using something like:

if(Table1.FindC ontrol("1B") != null)
{
labelID = "1C";
}
else if(Table1.FindC ontrol("1A") != null)
{
labelID = "1B";
}

Label lblType = new Label();
lblType.ID = labelID;

TableRow tr = new TableRow();

TableCell tc = new TableCell();

tc.HorizontalAl ign = HorizontalAlign .Center;

tr.Controls.Add (tc);

tc.Controls.Add (typeLabel);

Table11.Control s.Add(tr);

So whenever this code runs if it finds the latest Label for example "1B" it
will add a new tr and cell with an updated label "1C" or if it finds "1A" it
will update with new label "1B".

It does work with the initial label that is set in the .aspx file however
when run it again it will not find the new label to reupdate things.

Anyone have any suggestions?

thank you for any advice.
Mar 11 '08 #1
4 1005
What do you mean by 'run it again'??
When Postbacking...
the whole Page will be new, so make sure to add your newly created control
as well otherwise it will not exists.


"Durango200 8" <el********@yah 00.c0mschreef in bericht
news:b8******** **********@news svr13.news.prod igy.net...
Hi, I have a form which contains a table(Table1), within that table I have
label with an ID set to "1A".
Using something like:

if(Table1.FindC ontrol("1B") != null)
{
labelID = "1C";
}
else if(Table1.FindC ontrol("1A") != null)
{
labelID = "1B";
}

Label lblType = new Label();
lblType.ID = labelID;

TableRow tr = new TableRow();

TableCell tc = new TableCell();

tc.HorizontalAl ign = HorizontalAlign .Center;

tr.Controls.Add (tc);

tc.Controls.Add (typeLabel);

Table11.Control s.Add(tr);

So whenever this code runs if it finds the latest Label for example "1B"
it will add a new tr and cell with an updated label "1C" or if it finds
"1A" it will update with new label "1B".

It does work with the initial label that is set in the .aspx file however
when run it again it will not find the new label to reupdate things.

Anyone have any suggestions?

thank you for any advice.

Mar 11 '08 #2

"pipo" <no****@me.comw rote in message
news:On******** ******@TK2MSFTN GP06.phx.gbl...
What do you mean by 'run it again'??
When Postbacking...
the whole Page will be new, so make sure to add your newly created control
as well otherwise it will not exists.
I do add the new control with the lines:
TableRow tr = new TableRow();
TableCell tc = new TableCell();
tc.HorizontalAl ign = HorizontalAlign .Center;
tr.Controls.Add (tc);
tc.Controls.Add (typeLabel);
Table11.Control s.Add(tr);

Did you mean something else?
Mar 12 '08 #3
What do you mean by 'run it again'??
"Durango200 8" <el********@yah 00.c0mschreef in bericht
news:zf******** ***********@new ssvr21.news.pro digy.net...
>
"pipo" <no****@me.comw rote in message
news:On******** ******@TK2MSFTN GP06.phx.gbl...
>What do you mean by 'run it again'??
When Postbacking...
the whole Page will be new, so make sure to add your newly created
control as well otherwise it will not exists.

I do add the new control with the lines:
TableRow tr = new TableRow();
TableCell tc = new TableCell();
tc.HorizontalAl ign = HorizontalAlign .Center;
tr.Controls.Add (tc);
tc.Controls.Add (typeLabel);
Table11.Control s.Add(tr);

Did you mean something else?


Mar 12 '08 #4

"pipo" <no****@me.comw rote in message
news:%2******** ********@TK2MSF TNGP06.phx.gbl. ..
What do you mean by 'run it again'??
I meant postback sorry for confusion.
Mar 12 '08 #5

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

Similar topics

15
3673
by: drdoubt | last post by:
using namespace std In my C++ program, even after applying , I need to use the std namespace with the scope resolution operator, like, std::cout, std::vector. This I found a little bit cumbersome to always include std. I somewhere found a trick to overcome this problem. By using using std::cout;
19
4093
by: James Fortune | last post by:
I have a lot of respect for David Fenton and Allen Browne, but I don't understand why people who know how to write code to completely replace a front end do not write something that will automate the code that implements managing unbound controls on forms given the superior performance of unbound controls in a client/server environment. I can easily understand a newbie using bound controls or someone with a tight deadline. I guess I need...
11
2795
by: my-wings | last post by:
I think I've painted myself into a corner, and I'm hoping someone can help me out. I have a table of books (tblBooks), which includes a field (strPubName) for Publisher Name and another field (strPubCity) for Publisher City. These two fields have a many-to-one relationship with tables, (tlkpPubName and tlkpPubCity) respectively. The lookup tables only have one field (strPubName and strPubCity), which is their primary key. I also have...
7
3301
by: Timothy Shih | last post by:
Hi, I am trying to figure out how to use unmanaged code using P/Invoke. I wrote a simple function which takes in 2 buffers (one a byte buffer, one a char buffer) and copies the contents of the byte buffer into the character pointer. The code looks like the following: #include <stdio.h> #include <stdlib.h> #include "stdafx.h" BOOL APIENTRY DllMain( HANDLE hModule, DWORD ul_reason_for_call,
48
3224
by: Chad Z. Hower aka Kudzu | last post by:
A few of you may recognize me from the recent posts I have made about Indy <http://www.indyproject.org/indy.html> Those of you coming to .net from the Delphi world know truly how unique and "huge" Indy is both as a project, in support, development, and use. But Indy is new to the .net world. Indy is a HUGE library implementing over 120 internet protocols and standards and comes with complete source. Its an open source project, but not...
4
7394
by: Phil | last post by:
k, here is my issue.. I have BLOB data in SQL that needs to be grabbed and made into a TIF file and placed on the client (could be in temp internet dir). The reason we need it in TIF format is there are multiple pages per invoice. How can I grab the data, make the TIF, place it on the client and then Open with the clients default program for veiwing TIF's (usually Microsoft Picture and Fax Viewer). Please help.
2
4434
by: Keith Kowalski | last post by:
I anm opening up a text file reading the lines of the file that refer to a tif image in that file, If the tif image does not exist I need it to send an email stating that the file doesn't exist then skip this file and move onto the next file (line). If file is there then move to a sirectory. Here is the code I have (Feel free to make corrections as needed. If possible make changes in red)
15
4597
by: Cheryl Langdon | last post by:
Hello everyone, This is my first attempt at getting help in this manner. Please forgive me if this is an inappropriate request. I suddenly find myself in urgent need of instruction on how to communicate with a MySQL database table on a web server, from inside of my company's Access-VBA application. I know VBA pretty well but have never before needed to do this HTTP/XML/MySQL type functions.
4
2750
by: Quas.co.ua | last post by:
Hello all. I need your help. I need C compler to make demo of some technologie. This C compiler I need to write program which after run will be located in one segment of memory and it generates another code an write it into another (second) segment. And after some fragment of code is generated program from first segment runnes just generated code from second segment which may return in first
20
4257
by: mike | last post by:
I help manage a large web site, one that has over 600 html pages... It's a reference site for ham radio folks and as an example, one page indexes over 1.8 gb of on-line PDF documents. The site is structured as an upside-down tree, and (if I remember correctly) never more than 4 levels. The site basically grew (like the creeping black blob) ... all the pages were created in Notepad over the last
0
8360
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
8876
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...
1
8556
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
8642
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7387
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
4371
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2774
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
2011
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1777
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.