User Profile
Collapse
-
Oh, I was just using mine as an example and didn't put much thought into it, but you are right that any of them could be null and cause an exception, and should all be bracketed off just like you did. Thanks for making my answer better :) .... -
I find that whenever I get that error, it's that the code is returning something that is null to a variable, and then I'm trying to test that variable for something, like:
...Code:SPList myList = oWeb.GetList("\Lists\SomeList"); SPItem oItem = myList.GetItemByID(1); string myFieldVal = oItem["someField"].ToString(); if (myFieldVal == "hello world") { return true; } else { return false; }Leave a comment:
-
Actually I figured out later it involved the accounts I was running the app under. On my local dev machine it was running under my service account's privileges. When I moved it to the server, I found out it was under the Network Service account, not carrying over the service account's privileges due to a double-hop issue. Surprised it didn't raise a security exception, but it didn't. So it was a lot more complicated than just not writing to the...Leave a comment:
-
Yeah, sorry, it's on a computer at my other office, but I think I remember it pretty clearly as I burned out a Saturday on it (this past weekend).
What I was trying to do with the HtmlForm was something like was done in a blog posted here, just with adding dropdown items from SharePoint list items instead of buttons from XML items, but the concept is the exact same, so it seemed there was a proof of concept out there, already:
...Leave a comment:
-
This was for use in a User Control, not the page itself. User Controls do not load as a page, but could be referenced in code-behind as an HtmlForm. I actually found an easier way than to append to the aspnetForm object, though.
I put an ASP panel on my main page (ASPX file), and in the Page_Init, dynamically loaded my User Control to it with code like you have above:
...Code:myCtrl = Page.LoadControl("~/MyWebUserControl.ascx")Leave a comment:
-
Dynamically Load DropDownList Into Page
Not enough info on the user control part. You only have how to load the user control itself, dynamically, from the host page, which only in rare circumstances would you need to do (you could always redirect a user to another page, instead). You don't say how one might load something within that user control dynamically, how to get handles to the form, etc. In my user control's code-behind I put
and...Code:public HtmlForm aspnetForm;
-
I figured out a way to make what I was trying to do work. It's funny - I was doing the exact same thing using ASP that I did with Atlas, but the Atlas stuff worked and the ASP stuff didn't. I still don't get it, because you can literally swap out the ASP timer for an Atlas one and the Atlas one will tick, the ASP one won't until all of the other server side code has been run, even if you put it in a new Thread like I used from an Atlas-enabled...Leave a comment:
-
Updating a label constantly after onclick
Thank you very much for your help. This is everything I did, for the benefit of someone in the future. I'm fairly new to AJAX, but I installed it from http://www.microsoft.com/downloads/e...displayLang=en, updated the web.config file using http://www.asp.net/AJAX/documentatio...SPNETAJAX.aspx,...Leave a comment:
-
Well, what I was doing was setting a span on the page equal to this text. I wanted the span to be able to show the progress to a user ("Row 1 of 14298 processed", etc.) as the DataTable is being looped through. I found that, even if I put the code into the _Default class (to prevent instantiation issues) and had it try and update the field "updateText " as the counter increased, it doesn't show on the page, at least while debugging...Last edited by Frinavale; Dec 21 '09, 02:11 PM. Reason: Please post code in [code] ... [/code] tags. Added code tags.Leave a comment:
-
So what changed property would it be firing on? And is that the right syntax for the event?
I was trying this another way, too - as the foreach loop processes and increments the counter I have, couldn't I just set the innerHTML updating to occur there? But the thing is, _Default defaultClass = new _Default() won't instantiate the _Default class where my page is, so that it could run a function there that would take care of the innerHTML...Leave a comment:
-
Bare with me, I'm fairly new to delegates, interfaces, and events, even though I've been doing C# for almost 2 yrs and VB/VB .NET since VB6.
Basically I wanted to do an event whenever a variable's value changed. A public variable value (essentially a counter) is increased as a DataTable is parsed through a foreach loop. The variable's value changing would trigger an event that would change the innerHTML of a span tag on the page...Leave a comment:
-
-
The ExecuteNonQuery statements are inside of a try...catch, so if there was an exception raised, the event would be logged since the EventLog routine is inside of my catch (wouldn't it?). I know the SqlCommands are valid since they will write the tables when the app is run from my workstation. All I'm doing is moving the app from my workstation to a server - I keep everything the same (connection string in the INI file, other INI settings). What...Leave a comment:
-
Thanks for the quick response. Yeah, I agree that was a little vague.
What I meant to say is that my program seemed to go through all of the motions, but not create the database or tables. I thought my "Console.WriteL ine" statements completed as they should, but it turned out I did need more in there - I had them before and after the call to the class that contains the SqlCommands that create the tables, before, and these...Leave a comment:
-
navyjax2 started a topic Database creation in SQL 2005 from C# - works from one computer, not the otherin C SharpDatabase creation in SQL 2005 from C# - works from one computer, not the other
Was hoping someone could give me some things to check here - I'm trying to figure this one out.
I've got a SQL connection string in an INI file, it is read into my C# .NET console app and connects to the database fine from my workstation. It processes the SqlCommand statements I use to drop the table (if it exists) and re-create it, and does an Insert statement to fill one row, and quits. This all works fine from my workstation (running... -
See http://support.microsoft.com/default...EN-US%3b914277.
Check also to see what the name of your SQL Server 2005 instance is (the name you see when you log into SQL Server itself). If SQL Server was installed with a Named Instance, instead of the Default Instance, it will be THAT name, instead of just the FQDN of the server. I had that issue and these two tidbits fixed me right up.
-TomLeave a comment:
-
epots9, not quite - the prompt never ends when you have "or" statements between it all. Thanks for trying, though.
Mods - sorry - forgot to look at that section...
But phvfl, you're awesome, thank you - your code worked great. I had posted an alert on "f" before and it told me what the values of it were and all, but I thought I had to have quotes on the "null" - guess I didn't! Was beating...Leave a comment:
-
Prompt window - OK/Cancel in Do While
My question is closely related to http://www.thescripts.com/forum/thread444945.html and was not answered there, so I figured I'd revive it since I think I have the same issue.
Here is my applicable code:
[code=javascript]
do {
var f=prompt('Would you like the output to be displayed in this page (1) or as a pop-up (2)','1');
}
while (f != "1" && f != "2" &&...
No activity results to display
Show More
Leave a comment: