|
AtALossHere wrote: when this is rendered, no ID is generated sin
ID of what? Every control would have an ID so that you can access it on client side. The snippet shared above has two controls and I see ID defined for both of them.
Please add ID at the time of placing controls and you can access column value associated with that control at runtime.
|
|
|
|
|
No, it isn't... when this is rendered, it just generates [td]Even geduld a.u.b.[/td] (the text assigned design-time) and nothing else...
|
|
|
|
|
Once again, you are expecting an ID for which control?
Grid converted in to a Table and ID's of its rows and columns? If so, why is it needed? You need controls ID's in them.
|
|
|
|
|
I'm expecting ID's for each of the row's labels. These are looked up server-side with
ClientScriptManager cs = Page.ClientScript;
foreach (GridViewRow gvr in GridView2.Rows)
{
Label lb3 = ((Label) gvr.FindControl("PERCS"));
cs.RegisterArrayDeclaration("PERCIDs", String.Concat("'", lb3.ClientID, "'"));
so the JavaScript can edit values with
x = document.getElementById(PERCIDs[i]);
x.value = "Assigned client side";
However, the
Label lb3 = ((Label) gvr.FindControl("PERCS"));
returns null because, browsing the generated page source, no ID is generated.
|
|
|
|
|
Sigh. Finally found the answer. If someone ever has a similar problem and finds this thread, this is what caused it for me.
In another piece of server code (the RowDataBound of the Gridview), this field was explicitly changed.
e.Row.Cells[PercentageKolomNummer].Text = cPercs;
It appears that, by doing this, the rendering "forgets" that it is a label and doesn't generate the ID for the label. By removing the assignment, the ID is generated and FindControl can find it again.
|
|
|
|
|
I'm trying to get my head around a good way to set up exception management in a custom class, if I understand some of the advice in CP articles and elsewhere correctly then something like this setup is 'a' good way:
Simplified case: A class encapsulates a 2D array and has an UpperBound property that takes a an integer and returns the UpperBound of that dimension (since it does not expose the array directly).
Rather than the UpperBound property testing that the integer is either 0 or 1, I should put the call to the array GetUpperBound(dimension) method in a Try block and catch the exceptions that can be thrown by the array method, then re-throw the exception from the encapsulating class with the array exception as the inner exception parameter. Is that smart?
Then if another method in the class uses the UpperBound property (in the encapsulating class) it should catch and re-throw the exceptions created by the UpperBound method (again with the inner exception as a parmater), hence the exception the programmer recieves has a trail directly from the methods they called through whatever path was then followed and ending up with the base exception thrown by the encapculated array.
For example:
Public ReadOnly Property UpperBound(ByVal dimension As Integer) As Integer
Get
Try
Return Me._matrix.GetUpperBound(dimension)
Catch inex As IndexOutOfRangeException
Throw New IndexOutOfRangeException("The dimension you specified is out of range for this matrix object. Matrix objects have only two dimensions, 0 and 1. See the inner exception for more detail.", inex)
Catch ex As Exception
Throw
End Try
End Get
End Property
Then if I had another method in my class (call it Iterate for example) that needed the UpperBound of the rows (dimension = 0), say to use in a For loop, it would again do this in a Try block, call the UpperBound property and catch the exceptions thrown by the UpperBound property. So if somehow this latter method (Iterate) managed to make a call to UpperBound(2) then the programmer would see the Iterate method throw an IndexOutOfRange exception with the UpperBound exception as its inner exception and that in turn would have the array GertUpperBound exception as an inner exception.
Smart, dumb - other names? Advice?
Mike
|
|
|
|
|
As long as your catching the exception adds value, then it's fine for you to catch it, add detail and then pass it back up the chain. A big note, in your sample though, you catch and throw the general purpose exception for no reason - as you are only interested in the IndexOutOfRangeException , that's the only one you should be catching there.
|
|
|
|
|
Thanks, Pete. In terms of adding value I am assuming that an exception raised by a method that you didn't call is harder to trace / debug, whereas if you have the full history then it should start with the method you called and you can then trace back to where that call went and probably have a better idea of where it went wrong - i.e. there's no apparent direct benefit of what I am doing in this (and most) cases other than tracing exceptions.
Pete O'Hanlon wrote: in your sample though, you catch and throw the general purpose exception for no reason That's something I saw in one of the CP articles (I think I interpreted it from this one[^]). I had read into it that what I am doing is saying that if anything I wasn't expecting happens, just re-throw the same thing to ensure you don't lose it, i.e. it's a side effect of a Try block. Maybe I assumed that without it I would in effect be 'swallowing' all other exceptions, but maybe that only happens if I catch the general purpose one and then leave the catch block empty?
Does your comment mean that it is redundant - i.e. is that what would have happended anyway, even without that last catch statement?
Thanks,
Mike
|
|
|
|
|
Mike-MadBadger wrote: I had read into it that what I am doing is saying that if anything I wasn't
expecting happens, just re-throw the same thing to ensure you don't lose it,
i.e. it's a side effect of a Try block. Maybe I assumed that without it I would
in effect be 'swallowing' all other exceptions, but maybe that only happens if I
catch the general purpose one and then leave the catch block empty?
Actually, what I was referring to was don't bother catching it at all. When you catch and throw, without doing anything with the exception, it's a waste of time. So, in your case, all you needed to catch was the IndexOutOfRangeException . Any other exception is still going to show your method in the stack trace, so there is still context there for you to work with.
I hope that explains it better.
|
|
|
|
|
I am thinking of an app (C# windows app ) as it just needs to be started once - it must itself stand and loop - so it detects when there are new images also the to run automatically afterwards. Please enlighten me some ideas I will be ever so grateful.
PS. I am using Visual Studio 2010
Kind Regards
JG
|
|
|
|
|
This makes very little sense as it stands right now. I'm sure that you have a great understanding of what you want your application to do, but sadly, you haven't managed to convey it. For instance, what does it need to run automatically?
As far as monitoring for new images, take a look at the FileSystemWatcher , but be aware that there are some limitations with it that you need to understand based around when it fires events.
|
|
|
|
|
Well I am sorry for not being very clear, the scenario is like this, I get a number of HDR pictures in a folder, I have a program which batches these images and put them out in different folders, This particular program can also be used with command-line, So what I am trying to do is create an windows app, where I want to use this particular command, so all the images go in a single folder. Therefore I want construct this app where once I have started it giving it a source, it should keep running and once new images arrive it just simply updates. I don't know if it's clear enough or its simple not logical.
|
|
|
|
|
Okay, some things to think of - you will want to put your processing on background thread, I would recommend using the Task Parallel Library for this as it's so easy to use. I'm not clear on whether you are moving the original image, or copying them - if you are copying them, then move them into a processed folder as soon as you are finished.
|
|
|
|
|
I make it even simpler in one folder I put an app which on Run command runs and checks its existence. Lets says there are jpg images in it e.g image1 image2 image3 then it loops checking if there is more. If there is nothing it just keeps running and if there are new it just updates.
|
|
|
|
|
I'm not sure what you want from me here. It sounds like you know exactly what you have to do here, so good luck with it. Please feel free to come back with any specific problems you have.
|
|
|
|
|
Hi
I'm hoping someone can point me in the right direction.
I'm trying to use EF within a Data Service, returning data from a SQL stored procedure.
I've successfully followed the quickstart here http://msdn.microsoft.com/en-us/library/dd728275.aspx[^] to get a basic service up & running against my own DB, rather than Northwind.
I've found this article telling me how to expose stored procedures http://msdn.microsoft.com/en-us/data/gg699321.aspx[^], which creates the expected public ObjectResult<t> entry in the model, but when my service tries to do the Quote: config.SetServiceOperationAccessRule("GetContact", ServiceOperationRights.AllRead); I get the error 'The given name 'GetContact' was not found in the service operations', even though I can see it as a public method in the object browser.
I have also found this article http://msdn.microsoft.com/en-us/library/cc668788.aspx[^] saying that to be exposed as a service operation for the service, it must return viod, IQueryable, IEnumerable, priomitive type or an entity type in the model.
How do I reconcile the latter requirement with the former ObjectResult way of doing things. My Google skills have failed me, so pointers to documentation will be welcome.
Regards, Stewart
|
|
|
|
|
How to use FileSystemWatcher Control ? in vb.net 2010.
|
|
|
|
|
I suggest you read the following article and work through it since it gives you a good understanding of how the file system watcher is used:
Watching Folder Activity in VB.NET[^]
|
|
|
|
|
DEEPAK9489@GMAIL.COM wrote: How to use FileSystemWatcher Control
Take your time to formulate a question; as it is now, I'd simply point to the documentation and answer "use it correctly".
What is it, specifically, that you need help with, or want advise on?
Bastard Programmer from Hell
if you can't read my code, try converting it here[^]
|
|
|
|
|
Hi, I recently found that knowing a .NET programming language itself isn't enough to become a pro .NET developer. So my question is where can I find best ebooks about knowing .NET framework structure, deeply and completely?
|
|
|
|
|
atoi_powered wrote: I recently found that knowing a .NET programming language itself isn't enough to become a pro .NET developer
.NET developer is very a broad term; it does not imply that you lack in-depth knowledge of the for loops, but that there are "area's" that you could still explore.
.NET can be used to develop web-apps, cross-platform desktop-apps and mobile apps. Did you try all three of those? Desktop can be divided into various GUI-concepts, like WinForms, WPF and Gtk#. Besides that, .NET offers some various additional technologies that are interesting to learn, like serialization, the MEF-framework, WCF and WF.
atoi_powered wrote: So my question is where can I find best ebooks about knowing .NET framework structure, deeply and completely?
Amazon, Manning, Google. Brownfield development[^] is a good place to start; even for greenfields
If you seriously want to dive deeper in the way .NET works, I suggest you Google for some CodeProject-article's on IL.
If you can specify what area of development you're targetting, you'll get a bit more specific answer.
Bastard Programmer from Hell
if you can't read my code, try converting it here[^]
|
|
|
|
|
i will also add MSDN to the above list ...
Regards,
Senthil Kumar
|
|
|
|
|
Thank you so much. I got what I should look for.
|
|
|
|
|
Warning 1 The referenced assembly "CrystalDecisions.CrystalReports.Engine, Version=13.0.2000.0, Culture=neutral, PublicKeyToken=692fbea5521e1304, processorArchitecture=MSIL" could not be resolved because it has a dependency on "System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" which is not in the currently targeted framework ".NETFramework,Version=v4.0,Profile=Client". Please remove references to assemblies not in the targeted framework or consider retargeting your project. StudentManagementSystem
i am getting this msg when i am compiling plz help
|
|
|
|
|
You have targetted the Client Profile in your project (take a look in the project properties). This doesn't include the web assemblies. You need to change your profile to the full .NET 4 profile to get access to System.Web.
|
|
|
|
|