.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

DataGrid SelectIndex inside a DataGrid

Posted By:      Posted Date: September 22, 2010    Points: 0   Category :ASP.Net

 Simply put... I want to duplicate the example found at this link, in VB.net rather than C#.


I would like the selectedvalue of the dropdown to display additional data base on its selection in multiple text boxes.

I have tried using the DropDownList OnSelectedIndexChanged property, within a DataGrid EditiItemTemplate, but I cannot retrieve data from the selection. (AutoPostBack is "True"). I can however use a button onclick event to fire a "prre-defined" selection value.

can any one be able to provide code example to do this? Would be Greatly Appreciated!!  Thanks

View Complete Post

More Related Resource Links

How to get the combobox value inside Datagrid on Edit button click event

Hi     I have Datagrid template column like<DataGridTemplateColumn.CellTemplate></DataGridTemplateColumn>DataGridTemplateColumn Header="Edit" x:Name="Edit" ><DataGridTemplateColumn.CellTemplate></DataGridTemplateColumn.CellEditingTemplate></DataGridTemplateColumn>SelectionChanged="cmbDGTeam_SelectionChanged" IsTabStop="True" /></DataTemplate><ComboBox Height="22" IsEditable="True" IsReadOnly="True" ItemsSource="{Binding}" DisplayMemberPath="Title" SelectedValuePath="TeamID" x:Name="cmbDGTeam"  SelectedValue="{Binding Path=TeamID,Mode=TwoWay}"<DataGridTemplateColumn.CellEditingTemplate><DataTemplate><DataTemplate><TextBlock Text="{Binding Title}"/></DataTemplate></DataGridTemplateColumn.CellTemplate><DataGridTemplateColumn Header="Team" Width="75"><DataGridTemplateColumn.CellTemplate> and Edit button Template column <DataGridTemplateColumn Header="Edit" x:Name="Edit" > </DataGridTemplateColumn.CellTemplate></DataTemplate><Button Content="Edit" IsEnabled="False" x:Name="btnEdit" Click="btnEdit_Click" ></Button>&l

Accessing Combobox inside WPF Datagrid Template Column

Hi, I am creating a WPF datagrid template column with combobox. The problem that I face now is, I am not able to bind a table to the combobox inside the WPF datagrid template column. Here is the code snippet. <dg:DataGrid x:Name="Students" AutoGenerateColumns="False" Loaded="OnLoad"> <dg:DataGrid.Columns> <dg:DataGridTextColumn Binding="{Binding Path=Name}" Header="Name" Width="75"/> <dg:DataGridTemplateColumn x:Name="Dept"> <dg:DataGridTemplateColumn.CellTemplate> <DataTemplate> <ComboBox x:Name="DeptId" ItemsSource="{Binding}" SelectionChanged="Dept_SelectionChanged" DisplayMemberPath="{Binding Path=DeptName}" SelectedValuePath="{Binding Path=DeptId}" SelectedItem="{Binding Path=Belongs}"/> </DataTemplate> </dg:DataGridTemplateColumn.CellTemplate> </dg:DataGridTemplateColumn> </dg:DataGrid.Columns> </dg:DataGrid> Please help me to find out the way to assign a dynamic source to the combobox through code behind file. Thanks in Advance!!! Best Regards, Subalakshmi Vijayarajan.

HDI : Enable and Disable checkboxes inside of DataGrid Template

I am again trying stuff that is a challenge.What i need to do is to enable and disable checkboxes in the gridI enable/disable them when i bind in grdDocApprovals_ItemDataBoundusing the following syntax( (CheckBox)e.Item.FindControl("chkReceived" )).Enabled = true;( (CheckBox)e.Item.FindControl("chkApproved" )).Enabled = false;That works wonderful. It disables the checkbox and i can not tick it.Now the problem comes in when i Tick the chkReceived box then i executemy javascript that finds the chkApproved box and is suppose to enable it.I noticed that in the HTML code during runtime there is a span and a td thatsurrounds the chkApproved. The <span>have a disabled = 'disabled' tag.and no matter what i do i can not get the chkApproved to be enabled. <span disabled="disabled"><input id="_ctl0_ContentMain_grdDocApprovals__ctl3_chkApproved" type="checkbox" name="_ctl0:ContentMain:grdDocApprovals:_ctl3:chkApproved" disabled="disabled" onclick="javascript:return response(this);" /></span>what can i do to get it active?

Click.CommandParameter null when binding on Button inside DataGrid DataGridTemplateColumn

I am having trouble getting a Click.CommandParameter to pass through with a bound Click.Command. I have a DataGrid with a DataGridTemplateColumn that contains a couple of Buttons. Using a suggestion found on the forum (http://social.msdn.microsoft.com/Forums/en/wpf/thread/541024a9-3d7e-4c6a-b88e-9a7eb7ee83a9), I was able to get the Click.Command to bind to the right command, but when arriving in the corresponding method in my ViewModel, the parameter is null.  Here is my xaml for my DataGridTemplateColumn <data:DataGridTemplateColumn Header="Case">  <data:DataGridTemplateColumn.CellTemplate>   <DataTemplate >    <StackPanel Orientation="Horizontal" HorizontalAlignment="Center">     <Button Content="Open" Margin="6,0" command:Click.Command="{Binding RelativeSource={RelativeSource AncestorType={x:Type data:DataGrid}}, Path=DataContext.OpenCaseCommand}" CommandParameter="{Binding}"  />     <Path Data="M1,1 L1,2" Stroke="#FFCCCCCC"/>     <Button Content="Rename" />    </StackPanel>   </DataTemplate>  </data:DataGridTemplateColumn.CellTemplate> </data:DataGridTemplateColumn> I used Snoop to see what was going on. Everything

Create controls inside the datagrid cell based on the datatype uisng WPF


I have a requirement that I need to develop a component which should display variable types of data inside a datagrid. The datagrid will have two coulmns. Fisrt column will display the list Captions (like: FirstName, DateOfBirth, IsMarried, Age) and the second column will display the list of data based on their data type, like:

> As FirstName is in string format it should display the value inside a TextBox control on right side of FirstName caption

> As DateOfBirth is in Date format it should display the Date value inside a DatePicker control on right side of DateOfBirth caption

> As IsMarried is in Boolean format it should display the CheckBox control with check state on right side of IsMarried caption

> As Age is in integer format it should display the integr value inside a TextBox Control on right side of Age caption.

If any body has any idea please guide me the way to develop. I request you to kindly help on this for creating this control



Access a control placed inside header template of a datagrid in WPF



I have a requirement to add filters to a datagrid. I have placed the filter controls in the headertemplate of a datagrid. How can I access these controls in code behind? I need to set itemsource for the listbox placed in header template through code behind on the basis of certain selections by user. Following is my data template(resource template) for header column.

<DataTemplate x:Key="buttonResourceTemplate">
      <StackPanel Name="spResource" FlowDirection="LeftToRight" Orientation="

Sorting and Paging in DataGrid which is inside asp:wizard



Would it be possible to do Sorting and Paging in a DataGrid, My dataGrid is place inside an asp:wizard which is inside an Update Panel.

<asp:UpdatePanel ID="upEditusr" runat="server">
<asp:Wizard ID="Wizard1" runat="server" CssClass="wizUsrAccess" displaycancelbutton="True" 
              oncancelbuttonclick="OnCancelButtonClick" onfinishbuttonclick="OnFinishButtonClick" OnNextButtonClick="OnNextButtonClick" ActiveStepIndex="0" BorderWidth="1px" DisplaySideBar="false">
               <asp:Label ID="SideBarInfo" OnPreRender="InitSideBarLbl" runat="server" /> 
               <asp:DataList ID="SideBarList" OnPreRender="LoadSideBar" RepeatLayout="Flow" Style="display:none;" runat="server"> 
                       <asp:LinkButton ID="SideBarButton" Visible="false" runat="server"></asp:LinkButton> 
                   <SelectedItemStyle Font-Bold="True"  />            

Command inside WPF 4 DataGrid RowDetailsTemplate Not firing


Hi all,

I am using VS2010 WPF4 + Prism 2.2 to build my application. In oder to demo the issue, I built a very simple application here:

The Xaml of window (MainWindow.xaml), I defined a DataGrid and a button. I bind command of button inside row details to a DelegateCommand defined in ModelView, I also bind button (below the DataGrid) to another command.

<Window x:Class="WpfApplication1.MainWindow"

Binding Command Inside DataGrid Using MVVM

In this post I will show you how to bind the commands inside the data grid control using MVVM pattern. For this post I have continue my last post which is used to explain the data pager using MVVM. For this post I have added DelegateCommand class which is added in the Classes folder. I have only one command in the viewModel (with the name HomeViewModel and is located in the ViewModel folder). The view for the Home is located in the View folder. Here you can see that I have added the HomeViewModel as resource in the home view which you can see in the Image 1.

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.

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.

Using the WPF Toolkit DataGrid

WPF comes with a large number of built in controls, but from the beginning it has lacked something that many application developers find extremely important - a DataGrid. You can use the ListView to create something approximating a DataGrid

A datagrid control that can be personalized... anyone??


Hello all,

I need a datagrid control that has following features, besides other regular stuff like paging, sorting, filtering, etc:

The user should be able to -

1. Select columns to view

2. Select column Sequence

3. Select default sort column

4. Store the setting (as a view) and use it on next visit.

5. llow multiple such views to be stored for a user for future use.

All these settings should be saved and when the user comes back he gets the same settings.

Really appreciate your time and would love to get any ideas.


- Zen



Dropdownlist Show the all PatientName and save the PatientID in the database and in datagrid showing the PatientID my requirement is that the PatientName show in DataGrid.

how to do ? 

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