|
You can also write:
Label lb= dgItem.FindControl("lblCompanyName") as Label;
Response.Write(lb.Text);
Maybe you have created a class with the name label and it tries to convert it to that class, so just to be sure add the whole namespace to the label.
|
|
|
|
|
Try:
Label lb = (System.Web.UI.WebControls.Label)dgItem.FindControl("lblCompanyName");
Response.Write(lb.Text);
HTH
|
|
|
|
|
thanks for ur reply.I've tried ur code but nothing happened however it does not generate any error.It did not print the text of the label.Is there others way?thanks for reading
|
|
|
|
|
Looks to me that it prints the code of the label but it's empty at this time... OR that this code is never actually executed. Try printing out a few non-space characters before and after the label text like:
Response.Write("*** "+lb.Text+" ***");
Now if you see some asterisks in the result then you know it's printing empty label. Then you have to figure out when this code is executed and what you actually have on this label. If you can't see any asterisks then obviously this code never gets executed...
HTH
|
|
|
|
|
From our Instant C# VB to C# converter:
string strCompanyName = null;
strCompanyName = ((Label)(dgItem.FindControl("lblCompanyName"))).Text;
Note that your original conversion was attempting to cast "dgItem" to a Label.
David Anton
www.tangiblesoftwaresolutions.com
Instant C#: VB to C# converter
Instant VB: C# to VB converter
Instant C++: C# to C++ converter
Instant C++: VB to C++ converter
Clear VB: Cleans up VB.NET code
|
|
|
|
|
Are you using masterpages ??
If you are then the controls id will not be "lblCompanyName"...it will be something like "ctl00_Main_lblCompanyName"...which is prefixed by the content placeholders id....so you should use the following code.
Label lb=(Label)dgItem.FindControl(this.lblCompanyName.ClientID);<br />
Response.Write(lb.Text);
This may help..possibly
Cheers,
Craig
** I'd rather try and fail than fail to try **
|
|
|
|
|
Native C# Protection (NCSP) is a protection tool (not obfuscator) for C# 2003 applications.
The goal of NCSP is to produce trial versions with limited functionality of C# applications.
With the correct NCSP Key these applications work as registered versions.
NCSP uses only NATIVE (but peculiar) TO C# means, i.e. NO EXTERNAL PROCESSING
of C#-produced executable.
NCSP protects NOT CODE, BUT DATA needed to run the application.
In case of C# applications DATA IS A CORRESPONDENCE BETWEEN EVENTS AND EVENT
HANDLERS.
The difference between trial and registered versions produced by NCSP is based
on use of DIFFERENT EVENT HANDLERS FOR TRIAL AND REGISTERED VERSIONS of the
protected application. The trial version uses one set of event handlers, while
the registered version uses another one.
NCSP protects forms of C# project on the source level, i.e. NCSP temporarily
MODIFIES THE SOURCE CODE, then, AFTER RE-COMPILING, THE APPLICATION IS
PROTECTED.
During the process of protection NCSP MODIFIES THE SOURCE CODE of the form in
such a manner that after re-compiling each protected event has no event handler
assigned. During the protected application start TRIAL EVENT HANDLERS ARE
ASSIGNED TO THE CORRESPONDING EVENTS. If valid NCSP Key is
provided then REGISTERED EVENT HANDLERS REPLACE THE TRIAL ONES.
The protected application DOES NOT USE a call of some CHECKING ROUTINE to
choose which set of event handlers to use. Instead it USES DATA containing in
NCSP Resource and in NCSP Key TO ASSIGN REGISTERED EVENT HANDLERS TO THE
CORRESPONDING EVENTS.
NCSP trial version may be downloaded from http://www.posolsoft.com/files/NCSP/NCSP.zip
More information about NCSP may be found at http://www.posolsoft.com/NCSP
Oleg Subachev
oleg@posolsoft.com
|
|
|
|
|
Keep your f*cking ads out of here!!
|
|
|
|
|
|
Yeah, I felt a little guilty just posting a link to my product in my auto-sig. Does anybody feel that that's out of line as well? Nobody's ever mentioned it before...
Visit BoneSoft.com
|
|
|
|
|
BoneSoft wrote: Yeah, I felt a little guilty just posting a link to my product in my auto-sig. Does anybody feel that that's out of line as well? Nobody's ever mentioned it before...
If your posts are relevant replies to other peoples questions I'm fine with it. If your posts are nothing more than thinly veiled advertisements for your product expect the torch and pitchfork brigade to be after you.
|
|
|
|
|
|
|
Not a problem.
I would suggest that you do something to it so that it looks like a signature and not part of the message text, though. Someone might think that visiting the site is part of your question or part of your suggestion to solve a problem.
---
b { font-weight: normal; }
|
|
|
|
|
Which wouldn't hurt my feelers in the least bit
Try code model generation tools at BoneSoft.com.
|
|
|
|
|
Hi All,
I have a function in my COM dll where in it expects paramter of type HWND.
I am interoping the COM dll in my windows C# application to make use of the method
The question how should I pass the My C# application window handle to C++ COM API?
I am trying to do like this , but it is not working as expected, any ideas where I am wrong ?
MyLib._RemotableHandle windowsHandle = new MyLib._RemotableHandle();
// Not sure what to pass here as I am not able to get much help here in MSDN
windowsHandle.fContext = ?????;
windowsHandle.u.hInproc = this.Handle.ToInt32();
The intent of doing this because HWND converted to _RemotableHandle in managed enviornmnet after interop'ng .
Thanks,
Varun
|
|
|
|
|
i am facing the same problem using VS2010. Can someone please help?
Thanks in advance.
|
|
|
|
|
Im writing an application that will monitor performance of our server. im using performace counters to achieve this. i was wondering if there is a way to clear performance counters programatically?
Thanks
Kulile --- RSA
|
|
|
|
|
I believe you should be able to set the PerformanceCounter.RawValue property to 0.
Logifusion[^]
|
|
|
|
|
Thanx, will try it now
Kulile --- RSA
|
|
|
|
|
Hi All,
I want to create a datagrid with 4 columns. The third column should have a combo box and the last column should have a checkbox. Its easy to get the checkbox column but how can I create a combo box column. The combo box should be visible always not only when it is selected.
Can any one tell me, how do I place combo box for each cell in third column of a windows datagrid contorl?
Any help is appriciated. Thanks in advance.
Regards
Kais
|
|
|
|
|
This is answer is without having VS in front of me and I didn't program ASP.net for some months so my memory of the terminology is a bit rusty.
Turn your datagrid column into <asp:templatecolumn> , then add an
<itemtemplate></itemtemplate> within the itemtemplate you can add your <ASP:DropDownList> , make sure to add the right events to the dropdownlist. If you want to fill the dropdownlist on runtime, you have to hook up to the itemdatabind (or something like that) event, there every row of the datagrid is being filled.
-- modified at 8:44 Wednesday 21st June, 2006
|
|
|
|
|
Thanks for that suggestion. It works for ASP.NET.
Am developing a windows application and using DataGrid available for winforms.
Is there a why how to do it in winform datagrid control??
Regards
Kais
|
|
|
|
|
I overlooked the "windows" part in the title.
There is a way, but since I don't have VS in front of me, its kind of hard for me to help you. I believe there is already a .NET object made by somebody that does this. I would use reflector and check how the other columns (checkbox, textbox etc) are made, and then in the same way create a dropdownlist column.
|
|
|
|
|
Searching for DataGrid ComboBox[^] gives several results. I think one of those should match your needs.
|
|
|
|