Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>We had solved the issue without using subgrids. Please check the following whether it matches your requirement.</p> <p>HTML Code Starts from Here</p> <pre><code>&lt;%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="Jquery3._Default" %&gt; &lt;%@ Register Assembly="Trirand.Web" TagPrefix="trirand" Namespace="Trirand.Web.UI.WebControls" %&gt; &lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt; &lt;html xmlns="http://www.w3.org/1999/xhtml"&gt; &lt;head runat="server"&gt; &lt;title&gt;&lt;/title&gt; &lt;link rel="stylesheet" type="text/css" media="screen" href="http://ajax.aspnetcdn.com/ajax/jquery.ui/1.8.11/themes/redmond/jquery-ui.css" /&gt; &lt;script src="js/jquery-1.5.2.min.js" type="text/javascript"&gt;&lt;/script&gt; &lt;link rel="stylesheet" type="text/css" media="screen" href="themes/ui.jqgrid.css" /&gt; &lt;script src="js/trirand/i18n/grid.locale-en.js" type="text/javascript"&gt;&lt;/script&gt; &lt;script src="js/trirand/jquery.jqGrid.min.js" type="text/javascript"&gt;&lt;/script&gt; &lt;%--Html Code begins here --%&gt; &lt;/head&gt; &lt;body&gt; &lt;form id="form1" runat="server"&gt; &lt;div&gt; &lt;script type="text/javascript"&gt; /** * Format the column [AsOfDate]. * Places label for the columns in the grouped rows * places Checkbox in the Group header */ function formatAsOfDate(cellvalue, options, rowObject) { if (parseInt(options.rowId) &gt; 0) { return "&lt;label&gt;" + cellvalue + "&lt;label/&gt;"; } else { return "&lt;input type=checkbox value=" + cellvalue + " onclick='SelectCheckbox(this," + options.rowId + ")'/&gt;" + cellvalue; } } /** * Format the column [DebtStatusId]. * Places label for the columns in the grouped rows * places Checkbox in the Group header */ function formatDebtStatusId(cellvalue, options, rowObject) { if (parseInt(options.rowId) &gt; 0) { return "&lt;label&gt;" + cellvalue + "&lt;label/&gt;"; } else { return "&lt;input type=checkbox value=" + cellvalue + " onclick='SelectCheckbox(this," + options.rowId + ")' /&gt;" + cellvalue; } } /** * To select/Deselect all the grouped rows based on the checkbox selected at group level. */ function SelectCheckbox(chkbox, groupingId) { var grid = jQuery("#&lt;%= JQGrid1.ClientID %&gt;"); var Rows = grid.find("TR"); $.each(Rows, function(i, item) { var label = $(item).find("label"); if (label.length &gt; 0) { $.each(label, function(i, labelitem) { if (labelitem.innerText === chkbox.defaultValue) { var CheckBox = $(item).find("INPUT.cbox"); $(chkbox).click(function() { if ($(this).attr("checked")) { CheckBox.attr("checked", "checked"); } else { CheckBox.removeAttr("checked"); } }) } }) } }); } /** * To Edit the Selected Row(s). */ function Selectedrow() { var grid = jQuery("#&lt;%= JQGrid1.ClientID %&gt;"); var rowKey = grid.getGridParam("selarrrow"); if (rowKey) { grid.editGridRow(rowKey, grid.editDialogOptions, { reloadAfterSubmit: false }); } else { alert("No rows are selected"); } } &lt;/script&gt; &lt;span style="font-size: 140%"&gt;&lt;b&gt;Group grid by:&lt;/b&gt; &lt;/span&gt; &lt;asp:DropDownList runat="server" ID="groupColumnDdl" AutoPostBack="true"&gt; &lt;asp:ListItem Text="DebtStatusID" Value="DebtStatusID" /&gt; &lt;asp:ListItem Text="AsOfDate" Value="AsOfDate"&gt;&lt;/asp:ListItem&gt; &lt;/asp:DropDownList&gt; &lt;trirand:JQGrid ID="JQGrid1" runat="server" Height="200px" OnRowEditing="JQGrid1_RowEditing" AppearanceSettings-Caption="First Grid" MultiSelect="true"&gt; &lt;Columns&gt; &lt;trirand:JQGridColumn DataField="DebtID" PrimaryKey="True" /&gt; &lt;trirand:JQGridColumn DataField="SequenceNumber" Editable="true" /&gt; &lt;trirand:JQGridColumn DataField="DebtStatusID"&gt; &lt;Formatter&gt; &lt;trirand:CustomFormatter FormatFunction="formatDebtStatusId" /&gt; &lt;/Formatter&gt; &lt;/trirand:JQGridColumn&gt; &lt;trirand:JQGridColumn DataField="AsOfDate" DataFormatString="{0:d}"&gt; &lt;Formatter&gt; &lt;trirand:CustomFormatter FormatFunction="formatAsOfDate" /&gt; &lt;/Formatter&gt; &lt;/trirand:JQGridColumn&gt; &lt;trirand:JQGridColumn DataField="Alias" Editable="true" /&gt; &lt;/Columns&gt; &lt;SortSettings InitialSortColumn="DebtID"&gt;&lt;/SortSettings&gt; &lt;EditDialogSettings CloseAfterEditing="false" /&gt; &lt;AppearanceSettings ShowRowNumbers="True" Caption="First Grid"&gt;&lt;/AppearanceSettings&gt; &lt;ToolBarSettings ShowEditButton="true" ShowRefreshButton="True" /&gt; &lt;/trirand:JQGrid&gt; &lt;input type="button" onclick="Selectedrow()" value="Edit" /&gt; &lt;div style="display: none;"&gt; &lt;input type='checkbox' id="chkTest" runat="server" /&gt; &lt;/div&gt; &lt;/div&gt; &lt;/form&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>Cs Code Begins here</p> <pre><code> using System; using System.Collections; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using System.Data; using System.Data.SqlClient; using Trirand.Web.UI.WebControls; namespace Jquery3 { public partial class _Default : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { JQGrid1.DataSource = GetData(); JQGrid1.DataBind(); GroupField gf = new GroupField(); //Dynamic Grouping based on the combo value selected switch (groupColumnDdl.SelectedValue) { case "DebtStatusID": gf = new GroupField { DataField = "DebtStatusID", HeaderText = "DebtStatus ID : {0}", GroupSortDirection = Trirand.Web.UI.WebControls.SortDirection.Asc, ShowGroupColumn = true, ShowGroupSummary = false }; break; case "AsOfDate": gf = new GroupField { DataField = "AsOfDate", HeaderText = "AsOfDate : {0}", GroupSortDirection = Trirand.Web.UI.WebControls.SortDirection.Asc, ShowGroupColumn = true, ShowGroupSummary = false }; break; } JQGrid1.GroupSettings.GroupFields.Add(gf); } protected void JQGrid1_RowEditing(object sender, Trirand.Web.UI.WebControls.JQGridRowEditEventArgs e) { var rows = e.RowKey; ArrayList ArrayOfIds = new ArrayList(rows.Split(new char[] { ',' })); for (int i = 0; i &lt; ArrayOfIds.Count; i++) { DataSet ds = GetData(); DataTable dt = ds.Tables[0]; dt.PrimaryKey = new DataColumn[] { dt.Columns["DebtID"] }; DataRow rowEdited = dt.Rows.Find(ArrayOfIds[i]); rowEdited["SequenceNumber"] = e.RowData["SequenceNumber"]; rowEdited["DebtStatusID"] = e.RowData["DebtStatusID"]; rowEdited["Alias"] = e.RowData["Alias"]; } JQGrid1.DataSource = GetData(); JQGrid1.DataBind(); } protected DataSet GetData() { if (Session["EditDialogData"] == null) { string ConnectionString = "Data Source =192.168.0.20; Initial Catalog = LW_TTX_IMPL; User ID=Development;password=jk;"; DataSet ds = new DataSet(); SqlConnection sqlconn = new SqlConnection(ConnectionString); SqlDataAdapter sqlAdp = new SqlDataAdapter(); sqlAdp.SelectCommand = new SqlCommand("SELECT DebtID,SequenceNumber,DebtStatusID,AsOfDate,'Alias'+Alias Alias FROM Debt_Profile", sqlconn); sqlAdp.Fill(ds); Session["EditDialogData"] = ds; return ds; } else { return Session["EditDialogData"] as DataSet; } } } } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload