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

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

Getting GridSplitters to function after dynamically adding WorkflowDesigner views

Posted By:      Posted Date: September 08, 2010    Points: 0   Category :WPF
I am new to WPF and an writing a program which re-hosts an instance of the WF4 System.Activities.Presentation.WorkflowDesigner.   The program itself works fine, but I am unable to get either of two vertical GridSplitters within a nested Grid to work properly once the WorkflowDesigner's view is assigned into that grid at runtime.   (The GridSplitters work until the WorkflowDesigner and PropertyInspector are created and its views set as children of the nested grid). The window has an overall layout grid (OverallLayoutGrid) and nests the original layout grid (LayoutGrid) as the middle of the three row OverallLayoutGrid.   The outermost main OverallLayoutGrid as three rows and one column.   The Main Menu is in the first row, the nested LayoutGrid is in the middle, and a StackPanel with an error displaylistbox and status bar is in the last row. The nested LayoutGrid has 5 columns and one row layed out with: Col0 - Vacant in static XAML, System.Activities.Presentation.ToolboxControl added during Window load Col1 - "LeftGridSplitter" Col2 - Vacant in static XAML, System.Activities.Presentation.WorkflowDesigner.View added during "File | New" creation of new workflow COl3 - "RightGridSplitter" Col4 - Vacant in static XAML, System.Activities.Presentation.WorkflowDesigner.PropertyInspectorView added dur

View Complete Post

More Related Resource Links

dynamically adding sql server columns based on number of files in fileuploader


I want to create a new table to sql database at runtime.  The column names would be "Name", "Date", "Event".  I would also like to have one more column name "Image" but the problem is that since the amount of images will vary, I want the application to count the amount of files in the Multiple fileuploader and then add a image column to the table for the respected amount of files. 

For example if i am uploading 3 files in the multiple fileuploader, the names should be "Name", "Date", "Event", "Image1", "image2", Image3"

I also would like that table name to be name dynamically from the textbox Name when the user enters the information.


I have the following code to make a new table, but I dont know how to name the fields at runtime like previously asked please help!!!


Dim objConn As New SqlConnection("Server=<servername>;uid=<userid>;pwd=<password>;database=master")


Adding carriage returns between 2 dynamically created controls in an HtmlTableCell


The title pretty much explains it. Here is what i'm trying to do...

 Private Sub LoadGrid_CommentsField(ByVal Row As HtmlTableRow, ByVal BookingNumber As String, ByVal CommentsText As String)
  Dim Txt As TextBox
  Dim Cmd As ClickOnceButton.ClickOnceButton

  Txt = New TextBox
  Txt.ID = "txtComment_" & BookingNumber
  Txt.CssClass = "TFAppControls"
  Txt.TextMode = TextBoxMode.MultiLine
  Txt.MaxLength = 500
  Txt.Width = New Unit(95, UnitType.Percentage)
  Txt.Text = CommentsText

  Row.Cells(cComments).InnerHtml &= "<br/>"

  Cmd = New ClickOnceButton.ClickOnceButton
  Cmd.DisableAfterClick = True
  Cmd.Text = "Save Comments"
  Cmd.ID = "cmdSaveComments_" & BookingNumber
  Cmd.CssClass = "TFAppButtons"
  Cmd.EnableViewState = False
 End Sub

On the line where i try and update the InnerHtml, i get the following error; "Cannot get inner content of  because the contents are not literal."

Workflow field not being added to list or views when adding a workflow


This problem just started happening in my entire site collection.  Anytime I associate a workflow to any list or doc lib the Workflow column that shows the status and links to the history is not beind added to the list or any views and is nowhere to be found.   Here's exactly what I'm doing:

1.  Go the List settings -> workflow settings -> add a workflow (for this example the OOB approval workflow)

2.  After adding I go to the List, the workflow column doesn't exist.

3.  I go to "modify view", and the workflow column is not listed in the available columns.

Any help is greatly appreciated.

Adding ContextMenu to WorkflowDesigner View

Hello Everyone,      I am trying to add the ability to have a user highlight an activity subtree, then right click the mouse, then select "Extract activity".  Which will then take out the xaml (ModelItem) selected, create a new activity out of it, then insert this newly created activity in its place.  Right now I'm stuck on getting a ContextMenu to appear when I right click in the designer area.  I can get my custom context menu to work in other places on the same window however.  Does anyone know the solution to this problem?  Also, does anyone have any better suggestions as to how I might achieve the same end result in a more efficient manner? Thanks everyone, Bob

Dynamically adding User Controls -- newbie question!

I am new to ASP.NET (coming from ColdFusion, thank goodness I'm away from that!).  And I am have THE hardest time understanding how to work with forms in ASP.NET.  Here's what I am doing:Dynamically add User Controls to a PlaceHolder based on some int value (which currently is passed in a HiddenField).Fire an event if the WebControls inside of the User Control change, then handle that event in the Main Page (i.e. save the input to DB)When the user clicks the "Next/Continue" button, the next controls for the next page are loaded.And I guess maybe I just can't seem to get how things work in ASP.NET, because I am really struggling with the general idea of how ASP.NET flows.  Should I be dynamically loading the controls in Page_Init, or Page_Load?  Or should I load the controls when the buttonclick event is fired?Do I have to add the axCtrl.OnDataChange += new EventHandler(HandleAxControlDataChange); line on Page_Load?  Or should I put this in When I first load the UserControl, I need to initialize some WebControls within the UserContorl.  Is there a way to know if I have loaded new user controls into my placeholder?  I can't use Page.IsPostback, because after the first page, every page is a postback from the buttonclick.Any help for this confused newbie would be GREATLY appreciated!!Here's what I have: pu

WPF: Adding checkbox with content Textblock at dynamically - width width returns NaN

I want to add set of checkbox at runtime one by one in one column. So i am creating check box object with content Textblock (Textwrapping = wrap) and adding to wrappanel but width of controls is NaN so i am not able to set location(Y co ordinate) of next checkbox. int lastheight = 10; private void btnadd_Click(object sender, RoutedEventArgs e) { CheckBox chk_add = new CheckBox(); chk_add.MaxWidth = 100; TextBlock tb_add = new TextBlock(); tb_add.MaxWidth = 100; tb_add.TextWrapping = TextWrapping.Wrap; tb_add.Text = "Here is long text so that text block will get split over two lines....... blah blah blah"; chk_add.Content=tb_add;     chk_add.Margin = new Thickness(10, lastheight, 0, 0); wrapPanel1.Children.Add(chk_add); lastheight += (int)chk_add.Width; } Can any any one have idea how can i tackle this issue.

how to adding dependencies to output cache dynamically?

Suppose i have an controller action that i would like to output cache. public class HomeController : Controller    {        [OutputCache(Duration=10, VaryByParam="none")]        public ActionResult Index()        {            // set  file dependency to the cache            return View();        }    } I need to dynamically set dependency to an external file  inside the code. How can i do that?      

adding an external image dynamically

hi Folks, i got a report with an image, the full qualified image is stored in an attribute like http://vmt-moss/Immo/NA23/NA23.jpg if I set the the property in SQL 2008 R1 RS to external and the value to imagepath (where the http link is stored) nothing doesn't been displayed. Additonally i am setting an Action to the image property, where also the imagepath value has been set, if click onto the image, image has been opened properly. Do I have to format the value to a Url Format ?   thx for your help

Possible bug: Calendar views browse month function not working when list is inserted as webpart.


Inserted a custom list with a calendar view on a page as webpart. Browse month function does not work, there is a postback but month is still the current month instead of the next or previous.

Is this a know issue/bug?

Adding multiple usercontrols dynamically


Hi all,

I have a simple user control which contains a textbox and a dropdownlist. I need to add this control multiple times to my page then save the details to my db, validating each control. When they re-enter my page I need to load the user control for each record in the db populated with the data they entered. They can then edit the data, delete the row or add new rows.

I'm trying to find the cleanest most efficient way to accomplish this. I realise I would need to re-add the user controls after each postback re-populating the data. Would the best way be to add each row to an arraylist or list of type object, save it to the viewstate and re-add the controls with data on postback, or is there another method which would suit?

I've looked high and low but can't find anyone with a similar problem/solution. 

Any help is much appreciated,

Adding Controls dynamically in the infopath form - A standard Expense Entry scenario



I am having a requirement where I need to create an Expense Report Entry form using Infopath 2010. 

1) The form would have pre-defined columns/Controls like Exp.Type(drop-down) , Details , Location, Amount , Curruncy, Date etc..

2) User can enter/update as many line items as possible by clicking Add/Update/Delete for the each line items. So basically its like adding the same row dynamically.

3) When User Submits, I need to capture this data and post it to SAP where I am using SAP web Services.

Can you please suggest if this is possible in InfoPath form ?

If Yes, how can I achieve this dynamic line items functionality in InfoPath

And how can I read the data using the code so that I can Post it to the WebService? 

InfoPath Forms : Adding rows dynamically from a SQL table along with a 'Delete' button per row


My requirement is something like this:

In a Task Approval form, I want to have a view which shows all the rows in a particular SQL table (in a infopath repeating table?). Along with each row, there should also be a button, on clicking which the row should disappear from the infopath view table. Do you think InfoPath can handle all this? :) 

To summarize:

1. How do I add rows to a table dynamically?

2. Per row, how do I create a button dynamically?

3. How do I remove the row from the view when the button is clicked?

Adding Multiple Selected Values to ListBox Dynamically


I have a ListBox control that gets populated from a database like this:

For Each gvr As GridViewRow In GridView1.Rows
                Dim lb As ListBox = CType(gvr.FindControl("SectionsListBox"), ListBox)
                For Each sect As String In sectionlist


Then the selected values also get populated like this:

For Each gvr As GridViewRow In GridView1.Rows
                Dim lb As ListBox = CType(gvr.FindControl("SectionsListBox"), ListBox)
                Dim faqid As Integer = gvr.Cells(0).Text
                selectedlist = oCMS.getFAQSections(faqid)
                For Each sect As String In selectedlist
                    lb.SelectedValue += sect


I need to have multiple selections, but I cannot get it to select multiple values with this line "lb.SelectedValue += sect".  The listbox has been set in aspx to allow multiple selections.


How to invoke c# function from another project without adding reference?



There is a C#.net libraray project whose dll name is customer.dll. It has a class name customer with a function name show(). I want to call this function from another project but dont want to add reference to the caller project. Can this be done? Is there any C#.net class that can acheive this?

Adding controls dynamically


Hi All,
I am creating a questionnaire in a gridview. The questions, answer options and answer control are under CMS. So I am building the questionnaire 'on the fly' adding controls to the page dynamically.

In Page_Load during !Page.IsPostback I bind the question text to the gridview then have another method that iterates through the gridview rows, and adds the controls to a cell eg.gvr.Cells[1].Controls.Add(rbl); The page renders correctly - I see all questions, answers and answer control eg, DropDownList, RadioButtonList, TextBox etc.

The problem is when I try to save the selected options, FindControl cannot find the controls. Even though when I view source I can see all ctrls and ids. I've seen a lot of posts about this issue and CreateChildControl, EnsureChildControl seem to be the route to take. But I don't unserstand how to use them. Can anyone point me to a good example?

And if anyone can explain why it is not working. The page 'looks' to be rendering correctly. Why then are the controls not being found on the postback? Are the controls not being added to the ViewState?


Dynamically Adding button in GridView



I am using the following to dynamically add button to the cell of gridview, condition is that if the value of the fourth column is empty, then in place of empty cell add the button. But nothing is happening.  I am making use of the following logic in  RowDataBound event in gridview.

protected void gdvEmployee_RowDataBound(object sender, GridViewRowEventArgs e)

for( int i=0;i<=dataSet.Tables[0].Rows.Count;i++ )
                if (dataSet.Tables[0].Columns[3] == null)
                    Button button = new Button();
                    button.Text = "ADD";
                   DataColumn dataColumn = new dataColumn();

Adding controls to a form dynamically


How to add checkboxes at a particular positon in a application dynamically.

That is ,I want to add checkboxs depending on the no of items in a collection and i even want to name it.How can i do it?

Can i get any sample code for it?

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