I am fairly new to SharePoint 2010 Development. I have created a Task Tray Web Part to list all the tasks (from Workflow Tasks List) awaiting action by the currently logged in user. It is required that when the user clicks on a task on the web part, the associated Infopath form opens for action. I cannot retrieve the URL behind the "Title" Column of the Workflow Task List. Can you show me how to retrieve the URL behind the Title Column of a Workflow Task List in code? C#,VB.Net or JavaScript? Is there another way of achieving this? Thank you.
I kind of took my second advice/comment. I wrote a function that generates the required URL. Using this, I can now call any workflow list item. If I ever find a way to solve the original challenge, I'll be sure to post it here.
Related
I have an ASP.NET 4.5 web form running C# code behind on a server. A specific form often takes some time to finish while it updates and changes various database records. However, if the user closes the tab or tries to reopen the web form, it will try to check the users status in the database and fail when those later change due to the first running process.
The need is to track this specific instance of the process and user, and if it is still running, prevent the page from loading fully or redirect. I was hoping to find and store some user and process information on a cookie and then simply check for this each time on page_load. I was not able to find these variables/properties.
Am I going about this the right way, and if so, how can I accomplish this?
Thanks!
I was not able to find the exact solution I was looking for. At the moment, I cannot see any way to find a server side identification id of the process.
Instead, I referenced How to tell if a page unload in ASP is a PostBack and made it so that the page would warn when being unloaded before the confirmation screen is shown. As long as the form opens to the same named tab, the user would be given the warning screen and given a confirmation before they could close or reload a new web form instance.
So I have an application that does:
Take n amount of links from SQL
Creates a new thread for each link
Get HTML code of this website with HTML-Agility-Pack for each thread
Saves its data to SQL (image sizes, page size, word count, words etc) and saves this process with its date
This is to check the data on a website and see if there is any changes (like a typo or a problem with images that were previously uploaded) and I want to add a screenshot/thumbnail to these for each page. How can I take a screenshot of the whole page during each thread?
In order to make a screenshot, you need your HTML to be rendered. This is a task for a web browser. As you are looking for a C# solution, you could use CefSharp (https://github.com/cefsharp/CefSharp) to render your html in offscreen mode.
Seems like an interesting app. As you already get the HTML for the entire URL (I would assume the app is running on a machine/server which has internet connectivity):
There are 3 ways you can do this (many more actually).
In the Thread - create a System.Windows.Forms.Form object, Add a webbrowser control to its list of Child Controls (Dock = Fill). Make the browser navigate to the url. Once navigation is complete - take the screenshot of the WinForms Dialog.
In the thread - launch chrome/IE web browser passing the Url as Command line argument. Wait for sometime in the thread (there isnt a good way to know when rendering finishes). Take the screenshot.
In the thread - Use selenium type of .net compatible library - which helps you do web ui testing automation and then do Step #2. You will have more granular control over the web browser using this approach.
First of all, I'm not sure if I am even going about this the best way in terms of design, but I'm a little new to Android and very new to Xamarin.Forms. My setup is a series of ContentPages in a Xamarin.Forms PCL that all deal with information from a REST service. This service, upon logging in, grants a WorkToken that the application then holds onto in order to perform further operations. I'm storing this in an ISessionManager.
My problem is a workflow issue. I have a LoginPage that I want to present to the user if their session has ended/faulted/whatever; basically if they aren't logged in and try to do anything, I want to push this page on the stack and force them to attempt to log in and if they provide valid credentials let them continue where they left off. All this is taking place, for the most part, in the PCL, but I've created an Android implementation of the ISessionManager that is queried on each ContentPage's overridden OnAppearing method. Each page calls ISessionManager's CheckLogin which will do just that, and if they aren't logged in, it will create an Intent and start the LoginActivity through that. LoginActivity essentially just wraps around the PCL's LoginPage.
The problem I am running into is that, doing it this way, the LoginActivity is run asynchronously on top of whatever page called it. This calling page is in a broken state, however, because it has not initialized properly through the REST service yet. I imagine there are two possible solutions. Either run the Intent synchronously (which I don't think is possible) or rethink my design. Here's the Intent setup:
var intent = new Intent(_context, typeof(LoginActivity));
intent.AddFlags(ActivityFlags.NewTask);
_context.StartActivity(intent);
I've checked several Xamarin forums for related posts on this, but have not found much beyond basic navigation workflows in Xamarin.Forms.
Edit: I've found something analogous to what I'm trying to do here: How to pass variables from a new intent back to the class that created it in android, but within the context of Xamarin.Forms. The startActivityForResult would solve my problem if it existed in Forms.Context, but there doesn't appear to be an equivalent.
Why are you creating a LoginActivity? is it because you need to use something native from android?
My first thought it's that after you check for the token status on the OnAppearing, you that can decide to push or not the modal for the login page, after the user login is done and the token is save, you can pop the modal and it will show the previous page the user was.
I'm quite new to asp.net and C# so bear with me. Also my apologies if this have been asked before... if so please direct me to a page which is of help.
What I have:
A page: With 4 updatepanels
1st UpdatePanel which contains a (item) gridview, user display options (not important to this question) and button which perform a database search which returns a list of items displayed to the grid. User selects an item on this grid...
2nd UpdatePanel contains a dropdownlist containing a list of available task loaded from an XML. User will select a task, which displays a bunch of available options/parameters (also loaded from XML file) to another (parameter) gridview in 2nd updatepanel. Gridview here will always have one row of data. I'm using gridview here because it is easier rather than creating dynamic controls (paramaters are different to each task ). User is able to enter parameter values into the grid. User clicks on an Add button and the the task is added to another gridview in the 3rd updatepanel.
3rd UpdatePanel contains a (task) gridview which contains all the task added by user. There's also a button which is suppose to batch run all the task. When the button is clicked, it goes through the (task) gridview looking for pending task to run. For each pending task, it calls a web service which handles the task appropriately. Web service returns the task result together with log output.
4th UpdatedPanel for now just contains a div that displays the log output returned from web service.
What I want to further work on and not know how is:
how do I perform an 'asynchronous' batch job? What i'm trying to achieve is that, when user clicks on the batch run button, the 3rd (task) updatepanel together with all it's control get disabled while the batch jobs run 'behind the scene'. Depending on the task, each task could take up to 5seconds each. If user had created 60 tasks, I would think this will also cause the page to timeout?
While the batch job is running, user can further search for other items in (item) UpdatePanel and add new tasks using (parameter) updatepanel to (task) updatepanel.
(Task) UpdatePanel will be showing a 'Job in progress...' overlay of some sort when job is running.
Hope you understand my question. Much appreciated if someone could be kind enough to give some guidance and/or directions on how to tackle this task
Further info:
Using Framework 3.5
Using Asp.net C# + Ajax
Web Service is of gSoap on a solaris box
Many thanks in advance.
Sorry for being a noob, i was trying to reply to your help but found that there's a limited of characters i can put in. I'll just update my own comments for now.
Thanks for your suggestion. Sorry for the late response, I've been looking around the other day and had made some changes, getting it to work with 'PageAsyncTask' and 'IAsyncResult'. I've created a web service class which will be called by the page. The new web service class will than called the gSoap web service. I've managed to some sort of running it 'asynchronously'.
I have a button which executes:
protected void StartASyncJob()
{
PageAsyncTask task = new PageAsyncTask(
new BeginEventHandler(BeginAsyncCommandTask),
new EndEventHandler(EndAsyncCommandTask),
new EndEventHandler(AsyncCommandTaskTimeOut), null);
RegisterAsyncTask(task);
}
BeginAsyncCommandTask will go through the grid, get the first pending task and calls the web service.
EndAsyncCommandTask will then retrieve the return results, writes out the (log) UpdatePanel. It will then execute StartASyncJob() again looking for the next pending record to process.
All this works ONLY if don't do anything else on the page.
If I was (while the asynchronous process was running ) to do a search for more items in (item) gridview or select a new task from
(task) dropdownlist, the event will not fire till the asynchronous web service process has completed. And when it's completed, the dropdownlist or search event fires, my log details returned from the web service is not updated.
I guess the 'wait' is caused by 'PageAsyncTask' being 'spawn' from the same page thread?
I would have thought having the 'asynchronous' web service will enable the user to do more than one thing at a time giving better user experience. But it seems I'm wrong and/or have not done it right.
I have not tried your suggestion of using QueueUserWorkItem; but before I do, may i ask if it will give the same effect as using 'PageAsyncTask'. Will using QueueUserWorkItem has the same effect of 'spawning from same page thread' ?
Many thanks in advance. Sorry if i've not explained myself well and please do let me know if you need me to post my code.
there are a few solutions, but depends on how much control you have on the server.
If you have full access control to server, you may create a separate application which will take care of the Tasks; the application can be a Windows Service, and the communication between your page and the application would be either a database or MSMMQ (the communication mainly means the list of the Tasks and their states - 1. to be executed, 2. executing 3. finished).
Another solution is in case you don't have full access control to server, but it will require to implement some communication between threads. Instead of having the application I described at point 1. you can have a separate thread, which can be started this way:
System.Threading.ThreadPool.QueueUserWorkItem(foo => LauchTaskRunner());
Suppose you implemented a method called LaunchTaskRunner which in a loop just processes the list of existing Tasks, the above line will start it into a separate process. You can communicate with this method (which is running in a separate thread) through some static variable (declared in the page), e.g.:
public class YourPage : System.Web.UI.Page{
static IList<Task> tasks;
static void LauchTaskRunner(){
// here make use of tasks variable
}
}
Everytime the (tasks)updatepanel gets refreshed, it should render based on tasks variable.
I'm looking for the best way to constantly check if data has been sent to our ASP.NET MVC application from a server. I would like to asynchronously check for data and update the view when data has been read.
I'm currently using a TcpClient to make a connection, and making the connection in the inherited custom base controller. Currently though I have to refresh the page for the updating of the view to take place.
Would there be a proper AJAX solution? or do I need to move the connection to the ActionMethod?
For complete solution use this free library : PokeIn
I would probably use jQuery to query some action at a specified interval and update the page accordingly.
I don't know what kind of data you're talking about, but let's look at a simple example. From you're question, it sounds to me like you're trying to do the following:
Suppose you are building Twitter and want to show the newest Tweets on the homepage. Well, you could have a script that just does a jQuery.GetJSON call to some URL (let's call it twitter.com/latest5tweets) that gets the latest 5 tweets. Then you would have a callback function that would take those tweets and paint them on the screen -- perhaps using some sort of nifty slide effect to remove the older ones from the screen and add the new ones.
Does that help?