.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

"Save as image" available programatically?

Posted By:      Posted Date: August 31, 2010    Points: 0   Category :Windows Application
Hi,With the rehosted designer it is possible to right click in the design area and choose to save the workflow as an image. This is cool functionality and was wondering if it was possible to call this programatically? This would then allow me to show an image of what the workflow looks like without having to load up the full designer.Does anyone know if this is possible or how it can be done.ThanksMatt

View Complete Post

More Related Resource Links

How to write SQL Datasource programatically in VB


Can someone pls help me to rewrite this programatically!


<asp:SqlDataSource ID="DS" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString %>"
                SelectCommand="SELECT * FROM [Products] WHERE ([ProductID] = @QSID)">
                    <asp:QueryStringParameter DefaultValue="" Name="QSID" QueryStringField="ID"
                        Type="Int32" />


Thank You in advance!


adding programatically FilteredTextBoxExtender


 Hello, I have a problem with adding programatically FilteredTextBoxExtender (i put the code below).

The problem is that nothing is outputed when page is renedered although TextBox and FilteredTextBoxExtender are added to container (table cell controls property in my case).


TextBox tbDictionaryEntryTextBox = new TextBox();
tbDictionaryEntryTextBox.ID = "tbDictionaryEntry_" + controlNameSuffix;
tbDictionaryEntryTextBox.Width = Unit.Pixel(controlWidth);
if (isNumeric) {
      ftei = new FilteredTextBoxExtender();
      ftei.ID = "fteDictionaryEntry_" + controlNameSuffix;
      ftei.TargetControlID = tbDictionaryEntryTextBox.ID;
      ftei.FilterType = FilterTypes.Numbers;
      ftei.Enabled = true;         
Best Regards,


Create databound nested ajax toolkit accordion programatically(In code Behind)


Can anyone guide me in the right direction or give an example of How I would accomplish this?


I have  this so far but kind of stuck on how to do it programtically if I'm using header and content templates 

I have a xmldatasource.. In a nutshell at what point in my code do I need to create a new accordion? does it need to be

in the item_databound handler?


Imports Microsoft.VisualBasic

Public Class AccordionTemplate
    Implements System.Web.UI.ITemplate

    Dim templateType As String

    Sub New(ByVal type As String)
        templateType = type
    End Sub

    Public Sub InstantiateIn(ByVal container As System.Web.UI.Control) _
          Implements System.Web.UI.ITemplate.InstantiateIn

        Dim ph As New PlaceHolder()

        Select Case (templateType)
            Case "Header"
                Dim myLabel As Label = New Label()
                myLabel.Text = "Test"
            Case "Content"
                ph.Controls.Add(New LiteralControl("<p>hello</p>"))
        End Select
    End Sub

End Class



Partial Class Accordion
    Inherits System.Web.UI.Page


Terminating a SharePoint Workflow Programatically



I have a custome workflow coded in VS 2005 and deployed in to GAC and associated to a List in the SharePoint Portel through MS SharePoint Designer.


When an Exception happened in the code, the worklow instance' Status is shown as "Error Occured" and get suspended. since this workflow instance is "hung up" at this list item another instance of the workflow can't run. To run another instance you have to go into the SP Portal --> List and click on the "Error Occured" under the workflow of the item and then you have to terminate the workflow by clicking on the "Terminate this workflow now" link.


I just need to do this function ("Terminating the workflow") in the code in my Catch block where i handle the exception of the workflow activity.


could some one please tell me how to do this? or even point me in the right direction?


i've so far tried varity of:





ActivityBind activityBind = new

SharePoint 2010 Long Starting if start workflow programatically


In SharePoint 2010, I'm starting workflow #2 programatically from my workflow #1. See code below:

					SPList currentList = web.Lists[new Guid(ListId)];
					SPListItem currentListItem = currentList.GetItemById(ListItem);

					//resolve any lookup parameters
					string workflowId = base.ProcessStringField(WorkflowIdentifier);

					//find workflow association by name
					SPWorkflowAssociation workflowAssoc = currentList.WorkflowAssociations.GetAssociationByName(workflowId, Thread.CurrentThread.CurrentCulture);

					if (workflowAssoc != null)
						//start the workflow
						SPWorkflow workflow = site.WorkflowManager.StartWorkflow(currentListItem, workflowAssoc, workflowAssoc.AssociationData, SPWorkflowRunOptions.Synchronous);

And workflow #2  will hang with Starting status (1-10 minutes), Then the workflow #2 status would be modified  to Completed.

I couldn't find how to start the workflow # 2 immediately and complete immediately without several minutes delay

Change Default Column Value programatically

On a Document Library Settings Page, there is a new setting in SP2010: "Change Default Column Value". Changing the default value of the Field is different from this value. Does anyone know what this value is and where to set it programatically? Also, what libraries is this setting available on? This code updates the field's default value but not the property mentioned above: SPField field = list.Fields["Column"]; field.DefaultValue = "DefaultValue"; field.Update(); Thanks!

Questions about setting dropdownlist selection programatically

I don't understand some things about setting the current selection of dropdownlists from code. I have a dropdown list of people's names where the Value is a Person_ID.  This gets loaded from SQL, and I added an Item which is "Please select..." to the top of the list and gave it a value of 0.  AppendDataBoundItems is true.   If I want to select an item from code can I use dropdownlist.SelectedValue=8 (for example)? Do I also have to set the SelectedItem.Text or does tha above do that for me? Can I instead set the SelectedIndex to some number if I happen to know it?  Will that set the SelectedValue and SelecteItem for me? If I want to set the list back so that nothing is selected (and Please select... shows) should I set SelectedIndex=0?  Is that the same as setting SelectedValue=0 in this case (since "Please select" has a value of 0)? I guess I'm confused on which of these 3 properties I should be using, to select an item (or deselect all items) in the list, using code. Thanks.

Get content of programatically created control before postback

Hi.I have quite a problem here, and hope you can help :)I´ll try to describe the problem in steps, as this might be the easiest to understand:1. Page_Load is called when the page is requested, and calls a BuildTable() method2. The BuildTable method creates a table which contains several textboxes3. the user types some text in these textboxes4. The userthen  changes an item in a Dropdownlist on the page which is intended to change some other content on the page5. Page_Load is called, and afterwards the DropDownListBookingType_SelectedIndexChanged(object sender,EventArgs e) method are called, and the content is changed6. The text the user typed in the programmatically created textbox controls are lost!Now how do I remain this text information? If just the SelectedIndex_changed method was called first, I could save it in session.. But as far as I can tell, all data on the page are discarded when you create a partial postback :(What to do?Thanks alot for your time!

How to Programatically SetCredentials for Secure Store Service Application in Sharepoint 2010 using

I have to setup Credentials for Secure Store Service application programatically. To get Stored Credentials I have following code and its working fine. using (SPSite site = new SPSite("http://vtlssp2010Dev")) //using (SPSite site = new SPSite("http://" + System.Environment.MachineName + "/sites/Site_Name"))d { Console.WriteLine(site.RootWeb.CurrentUser.Name); SPServiceContext context = SPServiceContext.GetContext(site); prov.Context = context; try { SecureStoreCredentialCollection cc = prov.GetCredentials(appID); foreach (SecureStoreCredential c in cc) { IntPtr ptr = System.Runtime.InteropServices.Marshal.SecureStringToBSTR(c.Credential); string sDecrypString = System.Runtime.InteropServices.Marshal.PtrToStringUni(ptr); Console.WriteLine(sDecrypString); } } catch (Exception ex) { Console.WriteLine("Unable to get credentials for application " + appID); Console.WriteLine(ex.Message); } Console.ReadLine(); } } All I want is to programmatically do set credentials like explained in this example on msdn. http://msdn.microsoft.com/en-us/library/ff798456.aspx Please help. Shamshad Ali  

Control this objectdatasource programatically from the code behind based on different button clicks

I have a page where you can search and display other data, very simple layout. 1 Gridview and 1 objectdatasource. But i have 4 possible buttons that can populate the gridview.. i would like to control my objectdatasource from the code behind based on the button you click. here is what i have right now.. but if possible, can this source not be hardcoded like this and only built in the code behind? <asp:ObjectDataSource ID="ObjectDataSource1" runat="server" SelectMethod="SelectDVRInfo" TypeName="DataAccessCode"> <SelectParameters> <asp:ControlParameter ControlID="ddlDVR" Name="dvrInfo" PropertyName="SelectedValue" Type="String" /> </SelectParameters> </asp:ObjectDataSource> I found this site with a solution to this persons issue, but i cant seem to get mine working this way. http://stackoverflow.com/questions/2404264/overwriting-controlparameters-of-datasources-in-code-behind I have  this as the code behind right now when you press the button.. what other parameter settings am i missing and is this the right order to populate them for the source to acknowledge my values?   ObjectDataSource1.SelectMethod = "SelectDVRInfo"; ObjectDataSource1.SelectParameters["MyParameter"]

LinqDataSource set parameters of select programatically

Hello, I have one SP that receives a parameter.That parameter is not going to be a textbox, dropdown, etc.Its going to be a session variable and not viewable on thee User Interface.Can somebody please tell me how can I set that parameter programatically with linqdatasource or dynamic data thx

Claim Task programatically / in code?

When a workflow task is assigned to a SharePoint Group, a user may click on the 'Claim Task' button near the top of the task form, or they can just start work on the task and not claim it. Claiming a task executes the OnTaskChanged event as does any change to the task form. Is it possible to claim a task using code ?  I already know who is executing the task (executor) ... and I want to claim the task on their behalf if it is not already claimed. How can I : claim a task using code determine if a task is already claimed using code Thanks for any pointers

HELP - Problems with programatically adding checkboxes

Here is the setup. I programatically add a Canvas, a Grid, and within that grid are two columns of checkboxes. I have the Canvas there for querying purposes (makes it easier). The problem is that after the method executes that does all this and the form is displayed the canvas is visible, but the checkboxes aren't. When I set a breakpoint at the end of the method and check to make sure that all the Children are where they are supposed to be, they are all in their correct places. For what it's worth here is the code for the method. I cannot, for the life of me, figure out why they are not being rendered. They are there there when breaking down the items children for each of the controls. private void AddItemsToQuestion(Canvas pQuestionCanvas, XElement pQuestion) { List<XElement> pItems = (from c in pQuestion.Elements("Item") select c).ToList(); if (pItems.Count <= 0) return; int iNumberOfRows = (int)Math.Ceiling((double)pItems.Count / 2); //get the question canvas name Dictionary<string, object> pQuestionTag = ((Dictionary<string, object>)pQuestionCanvas.Tag); string sQuestionName = pQuestionTag["Name"].ToString(); Canvas pItemsCanvas = new Canvas(); pItemsCanvas.Width = pQuestionCanvas.Width; pItemsCanvas.Height = iNumberOfRows * 25; Thickness pThick

How to detect mysql connector version programatically?

Hi experts,Can I programatically find the version of mysql .net connector on the host machine from asp.net and update my web.config accordingly?Thanks in advance.

custom sharepoint lists programatically with the forms?

hi,     can any one give a link to a post for creating Sharepoint Lists from scratch. i would like to know about creating custom lists from scratch like the NewForm.aspx, EditForm.aspx,AllItems.aspx .  i know we can create list from OOTB but i would like to know using object model please help.

How to use SharePoint web analytics data programatically?

Hello Everyone, We have a requirement to pull out the 10 most visited pages from a particular Content Type and show them on a Web Part. We need to display the titles of these articles. Therefore, I would assume that only way to proceed is to create a custom Web Part that programmatically retrieves the web analytic data (OOTB Web Anlytics Web Part cannot be used due to the lack of customizability). So far, we could not find any details on how to use web analytics data programmatically. Any help on this is greatly appreciated. * Note that SPWeb.GetUsageData() is useless as it returns only 2000 records. We also looked at the reflected code of Web Analytics Web Part, and the code is fairly complex as it directly consumes the Web Analytics Service Application.   Thanks & Regards, Amal  

Programatically remove IIS HTTP headers

Our IIS server (v7) has the following settings in its custome HTTP headers for the whole site: Pragma: no-cacheCache-Control: private, no-cache, no-store, max-age=0, must-revalidate, post-check=0, pre-check=0X-Powered-By: ASP.NET Out of the whole site there are some pages require to remove the "no cache" setting to work properly. This is done manually by IIS Administrator before. Now we were told that we need to do it from code on our end. The following code were applied but no luck in success. Please advise! Thanks! Response.Headers.Remove("Pragma")Response.Headers.Remove("Cache-Control")Response.Headers.Add("Cache-Control")Response.CacheControl = "System.Web.HttpCacheability.Public"
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend