GridView – Show headers on empty data source

ASP.Net 4.0 added the boolean ShowHeaderWhenEmpty property. http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.gridview.showheaderwhenempty.aspx <asp:GridView runat=”server” ID=”GridView1″ ShowHeaderWhenEmpty=”true” AutoGenerateColumns=”false”> <Columns> <asp:BoundField HeaderText=”First Name” DataField=”FirstName” /> <asp:BoundField HeaderText=”Last Name” DataField=”LastName” /> </Columns> </asp:GridView> Note: the headers will not appear unless DataBind() is called with something other than null. GridView1.DataSource = New List(Of String) GridView1.DataBind()

How to hide a column (GridView) but still access its value?

<head runat=”server”> <title>Accessing GridView Hidden Column value </title> <style type=”text/css”> .hiddencol { display: none; } </style> <asp:BoundField HeaderText=”Email ID” DataField=”EmailId” ItemStyle-CssClass=”hiddencol” HeaderStyle-CssClass=”hiddencol” > </asp:BoundField> ArrayList EmailList = new ArrayList(); foreach (GridViewRow itemrow in gvEmployeeDetails.Rows) { EmailList.Add(itemrow.Cells[YourIndex].Text); }

Best way to make WPF ListView/GridView sort on column-header clicking?

I wrote a set of attached properties to automatically sort a GridView, you can check it out here. It doesn’t handle the up/down arrow, but it could easily be added. <ListView ItemsSource=”{Binding Persons}” IsSynchronizedWithCurrentItem=”True” util:GridViewSort.AutoSort=”True”> <ListView.View> <GridView> <GridView.Columns> <GridViewColumn Header=”Name” DisplayMemberBinding=”{Binding Name}” util:GridViewSort.PropertyName=”Name”/> <GridViewColumn Header=”First name” DisplayMemberBinding=”{Binding FirstName}” util:GridViewSort.PropertyName=”FirstName”/> <GridViewColumn Header=”Date of birth” DisplayMemberBinding=”{Binding DateOfBirth}” … Read more

How to autosize and right-align GridViewColumn data in WPF?

To make each of the columns autosize you can set Width=”Auto” on the GridViewColumn. To right-align the text in the ID column you can create a cell template using a TextBlock and set the TextAlignment. Then set the ListViewItem.HorizontalContentAlignment (using a style with a setter on the ListViewItem) to make the cell template fill the … Read more

Create thumbnail image

You have to use GetThumbnailImage method in the Image class: https://msdn.microsoft.com/en-us/library/8t23aykb%28v=vs.110%29.aspx Here’s a rough example that takes an image file and makes a thumbnail image from it, then saves it back to disk. Image image = Image.FromFile(fileName); Image thumb = image.GetThumbnailImage(120, 120, ()=>false, IntPtr.Zero); thumb.Save(Path.ChangeExtension(fileName, “thumb”)); It is in the System.Drawing namespace (in System.Drawing.dll). Behavior: … Read more

Gridview height gets cut

After (too much) research, I stumbled on the excellent answer of Neil Traft. Adapting his work for the GridView has been dead easy. ExpandableHeightGridView.java: package com.example; public class ExpandableHeightGridView extends GridView { boolean expanded = false; public ExpandableHeightGridView(Context context) { super(context); } public ExpandableHeightGridView(Context context, AttributeSet attrs) { super(context, attrs); } public ExpandableHeightGridView(Context context, AttributeSet … Read more

How to set Custom height for Widget in GridView in Flutter?

The key is the childAspectRatio. This value is use to determine the layout in GridView. In order to get the desired aspect you have to set it to the (itemWidth / itemHeight). The solution would be this: class MyHomePage extends StatefulWidget { MyHomePage({Key key, this.title}) : super(key: key); final String title; @override _MyHomePageState createState() => … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)