gridview

GridView is scrolling back to top after row selection

℡╲_俬逩灬. 提交于 2019-12-12 09:32:32
问题 I've got one long GridView control on ma website. It allows row selection. The problem is, when I scroll down this GridView and select some of the bottom rows the selection occurs, but whole GridView is scrolling back to top. Does enyone know how to avoid this? 回答1: If it's happening during a postback, then in your <%@ Page %> directive you can add the following: MaintainScrollPositionOnPostback="true" This was added in .NET 2.0, and adds some JavaScript to the page to ensure that the page

How can i add image in a datatable?

不羁岁月 提交于 2019-12-12 08:59:12
问题 How can i add image in a datatable ? I tried the following code, Image img = new Image(); img.ImageUrl = "~/images/xx.png"; dr = dt.NewRow(); dr[column] = imgdw; But it showing text System.Web.UI.WebControls.Image in gridview instead of image. 回答1: try this code: DataTable dt = new DataTable(); dt.Columns.Add("col1", typeof(byte[])); Image img = Image.FromFile(@"physical path to the file"); DataRow dr = dt.NewRow(); dr["col1"] = imageToByteArray(img); dt.Rows.Add(dr); where imageToByteArray

Telerik RadGrid - How do I default to edit mode?

早过忘川 提交于 2019-12-12 08:50:12
问题 I want to make the items of my RadGrid be editable on page load. I've tried both methods here http://www.telerik.com/help/aspnet/grid/grddefaulteditmodeforgriditemsoninitialload.html but neither have any effect. The 2nd method for example, shown below where the Edit property is set on the ItemCreated event, causes the Edit mode to be set true (verified by debugger) but it has no effect on the results when the page is displayed. Anyone have any ideas what I'm doing wrong? protected void

GridView in ASP.Net — Selecting the correct row

落爺英雄遲暮 提交于 2019-12-12 08:43:55
问题 I have a page that includes a GridView in it. That GridView is paged with 10 items at a time. Normally, I want the user to select the item from the GridView and populate the FormView. This works well. I also want to support a query parameter ?ID=n where the page will load the specified item. How do I tell the DataGrid or the data source which item to set as the data context? I want the DataGrid to go to the proper page and select the item, showing the specified item in the FormView. I can't

How to add a GridView Column on code-behind?

痞子三分冷 提交于 2019-12-12 08:24:16
问题 I'm trying to add a column to a GridView, in ASP.NET 2.0 gridViewPoco.Columns.Add(...) However, i cant find the right option. I'd like equivalents to the following: <asp:BoundField> <asp:TemplateField> 回答1: For example; protected void Btn_AddCol_Click(object sender, EventArgs e) { TemplateField tf = new TemplateField(); tf.HeaderTemplate = new GridViewLabelTemplate(DataControlRowType.Header, "Col1", "Int32"); tf.ItemTemplate = new GridViewLabelTemplate(DataControlRowType.DataRow, "Col1",

Android Handling many EditText fields in a ListView

懵懂的女人 提交于 2019-12-12 08:02:10
问题 Just a basic question: If I have several dozen EditText fields that are part of a ListAdapter, how can the individual EditText fields know to which row they belong? Currently I am using TextWatcher to listen for text input. I have tried extending TextWatcher so that I can pass in the position of the EditText to TextWatcher's constructor. However, when the soft keyboard pops up, the positions that correspond to the various EditText fields shuffle. How can I track the EditText fields to their

How to display a loading image until a gridview is fully loaded without Ajax Toolkit?

99封情书 提交于 2019-12-12 07:19:19
问题 QUESTION Can anyone suggest how a loading image can be displayed until a gridview is fully loaded? This gridview is to be rendered on page load. There must be a simple solution to detect when gridview is loading/loaded so a simple toggle between load image and gridview visibility can be achieved. Please do not suggest using any of the Ajax toolkit methods unless the desired code can be isolated and used standalone. I have found the toolkit to be easy on implementation but bloated and slow on

Android beginner: Touch events in android gridview

夙愿已清 提交于 2019-12-12 07:15:21
问题 I am using the following code to do things with gridview(slightly modified from http://developer.android.com/resources/tutorials/views/hello-gridview.html). I want to replace the onClicklistener and the onClick() method with their "touch" equivalents i.e. touchlistener and onTouch() so that when i touch an element in the gridview the image of the element changes and a double touch on the same element takes it back to the orginal state. How do I do this? I can't get my code to do this. The

Trouble while Exporting GridView Data in Excel C#

怎甘沉沦 提交于 2019-12-12 07:07:33
问题 Having trouble while exporting the gridview data in excel. It is exporting the whole page not Gridview data. My Code as below : Response.Clear(); Response.Buffer = true; Response.ClearContent(); Response.ClearHeaders(); Response.Charset = ""; StringWriter strwritter = new StringWriter(); HtmlTextWriter htmlwritter = new HtmlTextWriter(strwritter); Response.Cache.SetCacheability(HttpCacheability.NoCache); Response.ContentType = "application/ms-excel"; Response.AddHeader("Content-Disposition",

Retrieve variable from LINQ query

廉价感情. 提交于 2019-12-12 06:47:08
问题 I am having problem when trying to retrieve something from LINQ query. I got a prodList which store all the product records. And another list is distSPUItemList which store the record distributed item records. Here is the codes: //Get list of products based on category and bind data to grid view prodList = prodPackBLL.getAllProductByCategory(category); gv.DataSource = prodList; gv.DataBind(); //Mark checkbox checked for products included in standard packing list var SPUItemList = new List