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

Post New Web Links

Dynamically update the datagrid...

Posted By:      Posted Date: September 30, 2010    Points: 0   Category :WPF


I have 2 datagrids in my application. One contains a list of devices that are being programmed over the air and the other should show the status of each programmed device. So I have 2 columns in the second grid (one with ID and one with Status). I want to populate this grid dynamically as and when a device is done programming. If it goes through without any issues then the status should say "Pass" if not the status should say "Fail". And in the row details section of each row, I should be able to print the entire status that is coming back from the programming.

So I wanted to know if it possible to accomplish such a task by dynamically populating the row as well as row details in the second grid?

Any help will be greatly appreciated.


View Complete Post

More Related Resource Links

How to format and update GridView and DataGrid rows using JQuery

The behavior described in this question is as expected. When you set text of a cell in grid, it directly affects HTML that is going to be rendered. When you set text value of a cell, it means that you are setting innerText of the cell. The column that GridView creates for command fields (Edit, Delete and Select) are a (anchor) or button elements. So you can see what will happen if you set text value in that cell. It will wipe out those link or button controls and replace them with simple text string.

dynamically add scrollbars to datagrid

 I am creating multiple datagrids at runtime within a placeholder. I want to add scrollbars to them.Please can someone help me as i dont know how to add scrollbars to datagrids created at runtime.I am using .net 1.1

How to dynamically add table rows within update panel ?

Hi, In my webform, i have 3-4 textbox, on there textchange event i have to fetch data from database and put it on the form. I have taken another html table (with runat="server")  below textbox and  and in textchange event created a new <tr>, <td> and simply added contents in <td>, then finally added <tr> in the table. This is done in UpdatePanel. When i enter something in textbox1 data is added in that table,that's fine. But when i enter something in 2nd textbox the previous data is overridden. My requirement is that if 2nd textbox's text changes than another row with appropiate data should be added, i.e., now two rows. Silimarly if 3rd ,4th textbox data changes then subsequently 3 or 4 rows should be displayed. What should i do ?

Dynamically Assign Datagrid Column Binding from XAML


I am trying to build a generic user control that will serve as a quick list maintenance screen.

I have a base ViewModel that has two string properties IDColumnName and DisplayColumnName and then a collection of objects to be edited.  Inherited view models will be created for each object type that needs to be maintained.  The usercontrols datacontext is set to the viewmodel.

What I want to do is have the datagrid, who's itemssource is bound to the collection of objects in the viewmodel, have one column and have that one column bound to the property specified in the DisplayColumnName property of the viewmodel, and I'd like to do it all in XAML.  I've got the datagrids rowdetailstemplate being dynamically determined based on the object type but am struggling with dynamically setting which property the one column displays.

Microsoft Matrix Framework DataGrid - Update Command - Convert empty strings to NULL



we have a AutoGenerateColumns-enabled WmxDataGrid in which we are able to update table rows in a DataBase connected with a SqlDataSource.

Each time we clear a field an empty string is written to the database where we want to write DBNull values.

At the moment we generate the update string via UPDATE... SET.. and the SQL Server function NULLIF(value, '').

Works proper but when I want to add the values to e.NewValues in BeginUpdate event I'm not able to read the values from the auto generated text boxes.

How do I do that? Is there an easier way to automatically convert empty strings to NULL values?


Dynamically building linkbuttons to update a panel ~ PostBackURL's


I have a pretty simple C # page that when the page first loads, a bio is diplayed in that center section based upon sql executed from my code behind.  I have 4 link buttons on the page that when clicked, fill that center section with other content based upon which link button they clicked (News, Publications, Contact Info, and Presentations).     I was all done, then I thought about using an UpdatePanel to get rid of the annoying "flicker" when the page posts back on the click of the link button. 

So, I added an update panel, and  the necessary triggers on the 4 link buttons, since they are outside of the UpdatePanel.   But, I'm stumped on what to do with the link buttons in the codebehind.  In my current code behind, I set the PostBackURL's programatically (see below), but if I want to use an update panel, should I still be building the Postback URL's?? 

lbPublications.PostBackUrl = "~/Person.aspx?PersonID=" + Request.QueryString[

Datagrid Link button within the Update panel events are not working



I have a datagrid with linkbutton within the datagrid.   When i click on link button there is no response.   I have tried in different ways like
1.   after data binding to the datagrid
2. AsyncPostBackTrigger ControlID="lnk1" EventName="Tick"

can any one please tell me How to fire the linkbutton

Thanks & Regards,

Problem getting AccordianPane to dynamically update?


Hey guys,

Would appreciate some help getting a AccordianPane's content to dynamically update via CodeBehind. I am newbie to ASP.NET and AJAX, so hopefully it's not something obvious about the ASP.NET page life cycle or something. Still not making sense to me though - and the Accordian is unusable with the current behavior. :(

The issue is that the ONLY place I can get the AccordianPane's content to update is in AccordianPane_Init - which is too early to pick up changes from other controls events (such as GridView index changing). Basically some changes in the data grid should be reflected in the AccordianPane.

Using the latest Ajax 4.0 Toolkit - 4.1.40412.2


    <asp:Accordion ID="Accordion1" runat="server" SelectedIndex="0"

            HeaderCssClass="accordionHeader" HeaderSelectedCssClass="accordionHeaderSelected"

            ContentCssClass="accordionContent" FadeTransitions="false" FramesPerSecond="40" 

            TransitionDuration="250" AutoSize="None" RequireOpenedPane="false" 

        SuppressHeaderPostbacks="true" V

Update datagrid and Event-Based Async calls


I’m using a datagrid (actually Infragistics XamGrid) which is bound to a custom list of business objects.  In the old WPF days, when completing the edit of a grid row, the business object’s EndEdit() method would be called via databinding.  The EndEdit() method would then save the data to the db via a web service call.  The retuning result of the web service call would tell the business object (in the EndEdit() method) of the call succeeded or failed.  If it failed, it would roll back the changes and raise an event to alert the UI.

In the world of Silverlight and Event-Based Async calls, it’s not possible to do all of this from in the EndEdit() method.

Also, I’m generating my web services using the SLsvcUtil.exe tool.  Since MS is forcing us to use Async calls, then what is the standard way to update data from a gird row and then roll it back and alert the UI when the call fails?

I found a nice article http://blog.jayway.com/2010/06/10/silverlight-prefer-synchronous-web-service-calls/ about making synchronous web service calls in SL, but the catch is that can’t be on the UI thread which – updating a gird row will be on.

Please relay any advice and resources you can offer!


WPF Datagrid binding as a subset of another Binding, does not update on new row



I have created 2 instances of this semi complex senario (similar to my previous post).  To start off, I have a many to many database relationship between 2 tables, so I created a linking table inbetween.  Take a dataset, make 3 tables, create a relationship from one table to another to the other.  So table A is has a many to many relationship to table B via table C (which simply links Aid, to Bid in a bunch of rows).  Take a WPF window, make 2 datagrids, one based on table A, and one based on the relationship table A has to table B.  (bind through the relationship not directly to the source table).  When you select a value in table A, table B's related values appear, and not the whole table B.  Got that far?

Datagrid B, for the relationship, is going to be bizzare...  Make a custom datagrid, add 1 column (a datagridtemplate column).  In the CellEditingTemplate, add a single combobox, with ALL of Table B as an ItemsSource. (we now should have 4 CollectionViewSources, All of Table A, Related A to C, Related C to B, All of Table B).  This can be done simply by using the DataSource window and opening table A, then open table C (inside of table A), then open table B (inside of table C, inside of table A), then drag table B into the window.  WPF will create all

Datagrid selected row does not update database


I have a datagrid that has a text column and a checkbox,on a tab control. If I add a row, the last cell selected will not update in the database unless I tab to the next row before I save, or I can tab back a row. It is clear that any selected cell will not be updated in the database on exit or save ever though I am using EndEdit(). 

   private void saveToolStripMenuItem_Click(object sender, EventArgs e)













Silverlight - Dynamically generating a table for datagrid


Hi there,


I am parsing a table in my Silverlight application. Lets say the table is as follows

*   A   B   C

A   1   2   3

B   3   4   6

C   2   2  2

I do not know before hand the column names, how many columns there are so, as far as I know, I can only see a solution to presenting this as a table with the traditional unbound data strategy as in windows forms.  However, my solution is in Silverlight, so I necessarely need to bind to an object.  But as said, I do not know the object properties, so I got stuck.  Please help; this seems like it should be very simple to display a parsed table.


Many thanks. 


ASP.Net Gridview Edit Update Cancel Commands

In ASP.Net 2.0, GridView Control also provides the functionality to edit and update the data retrieved from the database using CommandField template. You can cancel the action using Cancel Command of the CommandField. GridView consists of events that can be used to perform the actions like edit, update and cancel upon the Data items displayed in the ASP.Net GridView Data Control.

Use Jquery with repeater, gridview, datagrid

Before we talk about jquery inside any itemtemplate (repeater, gridview, datagrid), we need to understand the basic use of jquery functions

ListBox tricky to set in a DataGrid/GridView

Listboxes are very tricky to set selected items in grid - there is no real nice way to do it. It would have been great if Microsoft included a property that accepts an array or comma separated values - or anything! But they only allow each item in the list to be selected individually. The way to do this in a grid is a bit messy, but it is fairly simple to implement. When a row is created (as per the event), select the items of the listbox as per the datagrid source data:

How to highlight datagrid or GridView row on mouse over?

This article will show how you can Ajax with GridView to display popup messages when mouse moves over certain column. In the demo project I have added first column as an image column with a help icon in it. This kind of implements a feature that if you want more information about the row you can move mouse over this icon, a asynchronous request is sent to server for data about that row and when call returns the returned message is show as a popup message.

Multiple Column Dropdownlist for the ASP.NET DataGrid

Based on my previous control "Multiple Column DropDownList for ASP.NET", I received many emails asking for the same control to be used in the DataGrid for web applications. Here we go.. This control can be used as the regular MS DropDownList in the DataGrid and also as a regular dropdownlist. It has all the properties, like DataTextField, DataValueField, DataSource, SelectedIndex etc. The download file contains the samples both in VB.NET and C#. In this sample, I have used the Northwind database of SQL Server.
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