Android gridview keep item selected

I think a better approach is to tell the GridView that you wish to support selecting (checking) the items: gridView.setChoiceMode(GridView.CHOICE_MODE_MULTIPLE); and then make sure that items in GridView implement Checkable interface. That means that the items can be either Checkbox, ToggleButton and so on or you can add the Checkable support yourself – for example … Read more

How to hide columns in an ASP.NET GridView with auto-generated columns?

Try putting the e.Row.Cells[0].Visible = false; inside the RowCreated event of your grid. protected void bla_RowCreated(object sender, GridViewRowEventArgs e) { e.Row.Cells[0].Visible = false; // hides the first column } This way it auto-hides the whole column. You don’t have access to the generated columns through grid.Columns[i] in your gridview’s DataBound event.

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 find control in edit item template?

You need to databind the GridView again to be able to access the control in the EditItemTemplate. So try this: int index = e.NewEditIndex; DataBindGridView(); // this is a method which assigns the DataSource and calls GridView1.DataBind() DropDownList DdlCountry = GridView1.Rows[index].FindControl(“DdlCountry”) as DropDownList; But instead i would use RowDataBound for this, otherwise you’re duplicating code: … Read more

how to display images saved in sdcard folder in android [closed]

You can get the path of files from a particualr folder as below Once you get the path of files you ca display the images in gridview ArrayList<String> f = new ArrayList<String>();// list of file paths File[] listFile; public void getFromSdcard() { File file= new File(android.os.Environment.getExternalStorageDirectory(),”TMyFolder”); if (file.isDirectory()) { listFile = file.listFiles(); for (int i … Read more

Android GridView draw dividers

In case you want just simple lines as borders, much, much simpler is setting a background color for a GridView and proper padding & spacing: <GridView (…) android:background=”@color/LightGold” android:listSelector=”@android:color/transparent” android:horizontalSpacing=”1dip” android:verticalSpacing=”1dip” android:paddingLeft=”1dip” android:paddingTop=”1dip” />