gridview

Get the cell value of a GridView row

北慕城南 提交于 2019-12-21 03:32:50
问题 I am using the GridView - AutoGenerateSelectButton = "True" to select the row in order to get the Column 1 cell value. I have tried: GridViewRow row = dgCustomer.SelectedRow; TextBox1.Text = "Cell Value" + row.Cells[1].Text + ""; And it writes the "Cell Value" but nothing else. I finally was able to get the number of the row (index) but not the cell value. GridViewRow row = dgCustomer.SelectedRow; TextBox1.Text = row.RowIndex.ToString(); I have tried: TextBox1.Text = dgCustomer.Rows[row

Order items horizontal in XAML GridView (Win8 / Metro)

試著忘記壹切 提交于 2019-12-21 03:02:08
问题 how can i sort the items of GridView horizontal in the XAML? Sadly i found no method to achieve this. The Keyword "Orientation" is not available. Here is my current GridView: <GridView x:Name="TestDataBinding" HorizontalContentAlignment="Left" VerticalContentAlignment="Top" SelectionMode="None" ItemsSource="{Binding}" ItemTemplateSelector="{StaticResource itemTemplateSelector}" Margin="0,60,0,0" Width="1100" Height="540" /> Another Way could be a "VariableSizedWrapGrid". But this can't be

Jquery to move row up and down

邮差的信 提交于 2019-12-21 02:54:13
问题 I used the code given here to move rows up/down in a gridview using jquery and this works perfectly, but how can implement to move a row to first position or last in the table? 回答1: Add top and bottom links, and insert after/before the first/last row: DEMO JS: $(document).ready(function(){ $(".up,.down,.top,.bottom").click(function(){ var row = $(this).parents("tr:first"); if ($(this).is(".up")) { row.insertBefore(row.prev()); } else if ($(this).is(".down")) { row.insertAfter(row.next()); }

Dynamically adding a whole row in GridView, or splitting the View

瘦欲@ 提交于 2019-12-21 02:53:25
问题 I have a GridView with 4 columns, when one is selected, I wanted to dynamically add a whole row underneath the selected cell, and inflate a layout in it, so that I could add some information about the selected cell. Is there anyway to do that? Or maybe, is there a way to split a view in half, then glue it back together when done? Sounds crazy. Essentially, I'm looking for something you can find on iTunes 11 (see the picture below). 回答1: Yeah. You can do that. the xml file where you defined

GridView自动添加空白行

China☆狼群 提交于 2019-12-21 02:51:57
// 自动填充的行数 int numCount = 0; protected void Page_Load( object sender, EventArgs e) { if (!Page.IsPostBack) { GridView1.DataSource = CreateDataSourceByXianhuiMeng(); GridView1.DataBind(); } } protected void GridView1_RowDataBound( object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { // 计算自动填充的行数 numCount++; } if (e.Row.RowType == DataControlRowType.Footer) { // 计算完毕,在此添加缺少的行 int toLeft = TotalRowCount - numCount; int numCols = GridView1.Rows[0].Cells.Count; for ( int i = 0; i < toLeft; i++) { GridViewRow row = new GridViewRow(-1, -1, DataControlRowType

Asp.Net change value of textbox in grid on selected Index changed

本小妞迷上赌 提交于 2019-12-21 02:50:51
问题 I have this grid on which I am dynamically adding controls. Now I want to change the respective value of Cost Price and Sale Price on Products selected index changed event. The problem is I cannot get the specific row. Below the code I have done so far. <asp:GridView ID="grdSales" runat="server" ShowFooter="True" AutoGenerateColumns="False" CellPadding="4" CssClass="table table-hover table-striped" GridLines="None" OnRowDeleting="grdSales_RowDeleting" OnRowCommand="grdSales_RowCommand">

Bootbox confirm: return client result in order to do postback to rowCommand

社会主义新天地 提交于 2019-12-21 02:50:09
问题 Before bootbox, I did this on aspx file in gridview; <asp:Button ID="btnDelete" CssClass="btn btn-danger" OnClientClick="if(!confirmDelete()) return false;" runat="server" CommandArgument="<%# ((GridViewRow) Container).RowIndex %>" CausesValidation="false" CommandName="DeleteRow" Text="Delete"/> and on js file; function confirmDelete() { return confirm("Are you sure you want to delete the record?"); } And with confirmation, the gridview's RowCommand is triggered and the deletion is done. With

GridView动态创建列、多行表头

為{幸葍}努か 提交于 2019-12-20 23:44:28
一、动态创建列 : // 创建GridView列的方法 private void CreateGridColumn( string dataField, string headerText, int width, string headerStyle, string itemStyle) { BoundField bc = new BoundField(); bc.DataField = dataField; bc.HeaderText = headerText; bc.HeaderStyle.CssClass = headerStyle; //若有默认样式,此行代码及对应的参数可以移除 bc.ItemStyle.CssClass = itemStyle; // 若有默认样式,此行代码及对应的参数可以移除 GridView1.Columns.Add(bc); //把动态创建的列,添加到 GridView中 GridView1.Width = new Unit(GridView1.Width.Value + width); //每添加一列后,要增加 GridView的总体宽度 } 在GridView绑定之前,调用以上方法: // 绑定GridView的数据 private void BindGrid() { #region 添加动态列 GridView1.Columns.Clear(

DataTables add column dynamically to table

雨燕双飞 提交于 2019-12-20 21:00:24
问题 I'm using DataTables (datatables.net) to display data from an Ajax source and having trouble customizing it. One thing I would like to do is add a column so I can have for example an 'edit' button for each row. The closest thing to that in the examples is here but I can't get that to work with an ajax source. Currently, I'm using the following code to display my table: fnServerObjectToArray = function ( aElements ){ return function ( sSource, aoData, fnCallback ) { $.ajax( { "dataType": 'json

GridView动态添加列

不羁岁月 提交于 2019-12-20 19:57:31
public class MyTemplate : ITemplate { private string strColumnName; private DataControlRowType dcrtColumnType; public MyTemplate( string strColumnName, DataControlRowType dcrtColumnType) { this .strColumnName = strColumnName; this .dcrtColumnType = dcrtColumnType; } public void InstantiateIn( Control ctlContainer) { switch (dcrtColumnType) { case DataControlRowType .Header: // 列标题 Literal ltr = new Literal (); ltr.Text = strColumnName; ctlContainer.Controls.Add(ltr); break ; case DataControlRowType .DataRow: // 模版列内容——加载 hyperlink1 HyperLink hl = new HyperLink (); hl.ID = "hyperlink1" ; hl