gridview

Put focus back on a gridview's selected row after postback

隐身守侯 提交于 2019-12-24 10:36:56
问题 Is it possible to put focus back on a gridview row after that a selection of the row generates a postback? I'm trying to add an onkeydown handler on the gridview rows in order to use the keyboard for navigation. My problem, I believe, is that after the first postback, the selected cell loses focus, and so the next key stroke is not caught by the cell. I have the following code The grid view <asp:GridView runat="server" ID="gdvPersons" AutoGenerateColumns="false" onrowcreated="gdvPersons

GridView edit when bound to a Datatable

故事扮演 提交于 2019-12-24 10:12:16
问题 I am creating a website where our customers can order parts directly from us. I have a datatable setup and when users click a button it adds a quick detail of the order to a gridview. In the gridview, I have the edit and delete buttons enabled. the delete function works fine, however when you try to edit the information, it doesn't change the gridview with the new info. Here's what I have so far: protected void griditems_RowUpdating(object sender, GridViewUpdateEventArgs e) { DataTable dt =

Set first row to column name and adjust column width

折月煮酒 提交于 2019-12-24 10:09:19
问题 I have a problem. I created a GridView with a custom adapter. The GridView looks like this: As you can see the column names are not aligned with the column itself, because the column names are textviews. So I want to do something like, when the gridview gets filled and its on the first row, you first print the column names. The result I want is this: And when that is done, I want to adjust the column width for the whole column to the longest value that. So when I only have Buy and Sell, I

Gridview - click gridview item to show image in imageview

随声附和 提交于 2019-12-24 10:03:06
问题 I follow this toturial Android Lazy Loading images and text in listview from http json data and now i change listview to gridview. My question is I want to click gridview item and it show image in imageview MainActivity public class MainActivity extends Activity { GridView gridView; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); String strUrl = "http://ta.wptrafficanalyzer.in/demo1/first.php/countries/";

ASP.NET - Hierarchical grid view

夙愿已清 提交于 2019-12-24 09:58:40
问题 Any ideas on how I can acheive 'Hierarchical' gridview? Basically I want when the user clicks on the '+', i "expand" and insert new rows without a full page post back. Does this sound like a lot of AJAX stuff? Or should I read on ASP.NET MVC Please point me in right direction 回答1: Another way to do this is the old Grid view inside a Grid view Trick. The basic concept is to have the [+] and the parent data as the Item data in a single templated column. Attach the to click event of the button

Concatenate '$' with numeric value

▼魔方 西西 提交于 2019-12-24 09:52:57
问题 The SelectCommand for my GridView is as follows: SELECT pubName AS Publication, COUNT(*) AS Total, SUM(CAST (price as INT)) AS Price FROM [SecureOrders] WHERE DateTime >= DATEADD(day, -1, GETDATE()) GROUP BY pubName Where I'm doing the SUM AS Price bit, I want to add a dollar sign ($) to the start, so my data displays as $109, instead of just 109. I tried just doing '$' + SUM, but of course that didn't work. Is there a way around this? 回答1: Like in many languages, the plus sign is an

WPF: Binding DataGrid column header to ViewModel

安稳与你 提交于 2019-12-24 09:34:47
问题 I have a datagrid in which i manually specify the columns (AutoGenerateColumns="false"). I'm using MVVM and I would like to bind the column header (the text) so that I get it from my ViewModel. But I can't find a way to do that. The closest thing I've found is this: Wpf Toolkit. Bind DataGrid Column Header to DynamicResource ...which is a "trick" with which you can bind the column header to a string statically declared in XAML. But I need to get it from my ViewModel. The reason I want to this

Rendering a partial view with jquery

允我心安 提交于 2019-12-24 09:28:08
问题 The problem; I have a view with two partial views one view to handle client side msgs and a gridview. the gridview is a form and can delete update items. When deleting or updating error/success msgs are generated in tempdata however only the grid partialview is being rendered from the actionresult functions. I need a way to simply render the messages partial view without posting anything or redirecting it to the controller since the data already exists in tempData. View: <div id="page

GridView Delete Row

一笑奈何 提交于 2019-12-24 09:25:52
问题 I'm trying to delete a row in a gridview (the data is not in the database yet), so it should be a simple delete row, if anybody can please point me in the right direction.... This is what I have done: else if (e.CommandName == "DeletePart") { int index = Convert.ToInt32(e.CommandArgument); //#1 line GridView1.DeleteRow(index); //#2 line } The error that I am receiving is : "Input string was not in a correct format." (this happens on #1 line)... This is how the gridview looks like: (use a

Formatting DateTime in ASP.Net GridView while updating, without using c#

只愿长相守 提交于 2019-12-24 09:09:22
问题 Refer the code below: <asp:TemplateField HeaderText="DOB" SortExpression="dob" > <EditItemTemplate > <asp:TextBox ID="TextBox3" Width="60px" runat="server" Text='<%# Bind("dob", "{0:d-M-yyyy}") %>'></asp:TextBox> <asp:CalendarExtender ID="TextBox3_CalendarExtender" runat="server" Enabled="True" Format="d-M-yyyy" TargetControlID="TextBox3"> </asp:CalendarExtender> </EditItemTemplate> <ItemTemplate> <asp:Label ID="Label3" runat="server" Text='<%# Bind("dob", "{0:d-M-yyyy}") %>'></asp:Label> <