function IsRowChecked()
{
var bret = false;
var grid = igtbl_getGridById("sg");
var count = grid.Rows.length;
var checked = true;
var rowcount = 0;
var i;
var errMsg = "";
for (i = 0; i < count; i++)
{
var row = grid.Rows.getRow(i);
checked=row.getCell(0).getValue();
if(checked == "true")
{
rowcount++;
}
if(rowcount > 1){break;}
}
if (rowcount == 0)
{
errMsg += "Please check a checkbox to select a single customer.";
bret = false;
}
else if (rowcount == 1)
{
bret = true;
}
else if (rowcount > 1)
{
errMsg += "Please select only a single customer.";
bret = false;
}
//return bret;
if (errMsg == "")
{
return confirm("Are you sure that you want to clear the Quickbooks ID for the selected company?");
}
else
{
alert(errMsg);
return bret;
}
}
function checkCustomerLength()
{
var bret = false;
var grid = igtbl_getGridById("sg");
var count = grid.Rows.length;
var checked = true;
var rowcount = 0;
var i;
var customername;
var errMsg = "";
for (i = 0; i < count; i++)
{
var row = grid.Rows.getRow(i);
checked=row.getCell(0).getValue();
if(checked == "true")
{
customername = row.getCell(2).getValue();
if(customername.length > 40)
{
errMsg += "The customer name (" + customername + ") is greater than 40 characters in length. Please shorten the customer name on the 'Customer Details' page before continuing this operation.";
ret = false;
break;
}
}
}
if (errMsg == "")
{
return true;
}
else
{
alert(errMsg);
return bret;
}
}
Infragistics
Wednesday, August 6, 2008
Drill down report
(%@ Register TagPrefix="igtbl" Namespace="Infragistics.WebUI.UltraWebGrid" Assembly="Infragistics.WebUI.UltraWebGrid.v6.3, Version=6.3.20063.53, Culture=neutral, PublicKeyToken=7dd5c3163f2cd0cb" %)
(%@ Page language="c#" Codebehind="testpage.aspx.cs" AutoEventWireup="false" Inherits="bms.testpage" %)
(!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" )
(HTML)
(HEAD)
(title)testpage(/title)
(meta content="Microsoft Visual Studio .NET 7.1" name="GENERATOR")
(meta content="C#" name="CODE_LANGUAGE")
(meta content="JavaScript" name="vs_defaultClientScript")
(meta content="http://schemas.microsoft.com/intellisense/ie5" name="vs_targetSchema")
(LINK href="/ig_common/20063/Styles/Office2007Silver/ig_WebGrid.css " type="text/css"
rel="Stylesheet")
(/HEAD)
(body XMLNS:igtbl="http://schemas.infragistics.com/ASPNET/WebControls/UltraWebGrid" MS_POSITIONING="GridLayout")
(form id="Form1" method="post" runat="server")
(table border="1" width="50%")
(tr)
(td)(igtbl:ultrawebgrid id="UltraWebGrid1" runat="server" ImageDirectory="/ig_common/Images/")
(DisplayLayout AllowDeleteDefault="Yes" ColWidthDefault="100%" RowSizingDefault="Free" StationaryMargins="Header"
StationaryMarginsOutlookGroupBy="True" AllowSortingDefault="OnClient" RowHeightDefault="20px"
Version="2.00" ViewType="OutlookGroupBy" SelectTypeRowDefault="Extended" AllowColumnMovingDefault="OnServer"
HeaderClickActionDefault="SortMulti" BorderCollapseDefault="Separate" AllowColSizingDefault="Free"
RowSelectorsDefault="No" Name="UltraWebGrid1" TableLayout="Fixed" AllowUpdateDefault="Yes")
(AddNewBox Hidden="False")
(Style BorderWidth="1px" BorderColor="InactiveCaption" BorderStyle="Solid" BackColor="Window")
(BorderDetails ColorTop="White" WidthLeft="1px" WidthTop="1px" ColorLeft="White")
(/BorderDetails)
(/Style)
(/AddNewBox)
(Pager MinimumPagesForDisplay="2")
(Style BorderWidth="1px" BorderStyle="Solid" BackColor="LightGray")
(BorderDetails ColorTop="White" WidthLeft="1px" WidthTop="1px" ColorLeft="White")
(/BorderDetails)
(/Style)
(/Pager)
(HeaderStyleDefault BorderStyle="Solid" HorizontalAlign="Left" BackColor="LightGray")
(BorderDetails ColorTop="White" WidthLeft="1px" WidthTop="1px" ColorLeft="White")(/BorderDetails)
(/HeaderStyleDefault)
(GroupByRowStyleDefault BorderColor="Window" BackColor="Control")(/GroupByRowStyleDefault)
(FrameStyle BorderWidth="1px" Font-Size="8.25pt" Font-Names="Microsoft Sans Serif" BorderColor="InactiveCaption"
BorderStyle="Solid" BackColor="Window")(/FrameStyle)
(FilterOptionsDefault)
(FilterHighlightRowStyle ForeColor="White" BackColor="#151C55")(/FilterHighlightRowStyle)
(FilterDropDownStyle BorderWidth="1px" Font-Size="11px" Font-Names="Verdana,Arial,Helvetica,sans-serif"
BorderColor="Silver" BorderStyle="Solid" BackColor="White" Height="300px" CustomRules="overflow:auto;")
(Padding Left="2px")(/Padding)
(/FilterDropDownStyle)
(/FilterOptionsDefault)
(FooterStyleDefault BorderWidth="1px" BorderStyle="Solid" BackColor="LightGray")
(BorderDetails ColorTop="White" WidthLeft="1px" WidthTop="1px" ColorLeft="White")(/BorderDetails)
(/FooterStyleDefault)
(GroupByBox)
(Style BorderColor="Window" BackColor="ActiveBorder")(/Style)
(/GroupByBox)
(Images /)
(EditCellStyleDefault BorderWidth="0px" BorderStyle="None")(/EditCellStyleDefault)
(RowStyleDefault BorderWidth="1px" BorderColor="Silver" BorderStyle="Solid" BackColor="Window")
(Padding Left="3px")(/Padding)
(BorderDetails ColorTop="Window" ColorLeft="Window")(/BorderDetails)
(/RowStyleDefault)
(/DisplayLayout)
(Bands)
(igtbl:UltraGridBand Key="Level0" CellClickAction="RowSelect" Expandable="Yes")
(Columns)
(igtbl:UltraGridColumn HeaderText="Emp Name" Format="")
(Footer Key="")(/Footer)
(Header Key="" Caption="Emp Name")(/Header)
(/igtbl:UltraGridColumn)
(/Columns)
(/igtbl:UltraGridBand)
(igtbl:UltraGridBand Key="Level1" Expandable="Yes")
(Columns)
(igtbl:UltraGridColumn HeaderText="Active" Width="80%" Type="CheckBox" Format="" AllowResize="Free" Hidden="True")
(Footer Key="")(/Footer)
(Header Key="" Caption="Active")(/Header)
(/igtbl:UltraGridColumn)
(igtbl:UltraGridColumn HeaderText="Role Name" Width="94%" Format="" AllowResize="Free")
(Footer Key="")
(RowLayoutColumnInfo OriginX="1")(/RowLayoutColumnInfo)
(/Footer)
(Header Key="" Caption="Role Name")
(RowLayoutColumnInfo OriginX="1")(/RowLayoutColumnInfo)
(/Header)
(/igtbl:UltraGridColumn)
(/Columns)
(/igtbl:UltraGridBand)
(igtbl:UltraGridBand Key="Level2")
(Columns)
(igtbl:UltraGridColumn HeaderText="Role Desc" Width="50%" Format="" AllowResize="Free")
(Footer Key="")(/Footer)
(Header Key="" Caption="Role Desc")(/Header)
(/igtbl:UltraGridColumn)
(igtbl:UltraGridColumn HeaderText="Is Primary" Width="50%" Type="CheckBox" Format="" AllowResize="Free")
(Footer Key="")
(RowLayoutColumnInfo OriginX="1")(/RowLayoutColumnInfo)
(/Footer)
(Header Key="" Caption="Is Primary")
(RowLayoutColumnInfo OriginX="1")(/RowLayoutColumnInfo)
(/Header)
(/igtbl:UltraGridColumn)
(/Columns)
(/igtbl:UltraGridBand)
(/Bands)
(/igtbl:ultrawebgrid)
(/td)
(/tr)
(tr)
(td)(asp:button id="Button1" runat="server" Text="Get value")(/asp:button)
(asp:button id="Button2" runat="server" Text="Load")(/asp:button)(/td)
(/tr)
(/table)
(/form)
(/body)
(/HTML)
#region using
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using System.IO;
using System.Text;
using BMSQBInterface;
using bmsFramework.MyAccount;
using Infragistics.WebUI.UltraWebGrid;
#endregion
namespace bms
{
///
/// Summary description for testpage.
///
public class testpage : System.Web.UI.Page
{
protected BMSQBServer bmsQBServer = null;
protected DBConnection dbc;
protected cmaDBInterface odb;
protected System.Web.UI.WebControls.Button Button1;
protected System.Web.UI.WebControls.Button Button2;
protected Infragistics.WebUI.UltraWebGrid.UltraWebGrid UltraWebGrid1;
protected System.Data.SqlClient.SqlConnection myConn;
private void Page_Load(object sender, System.EventArgs e)
{
if(!Page.IsPostBack)
{
UltraWebGrid1.Width = Unit.Empty;
UltraWebGrid1.Height = Unit.Empty;
UltraWebGrid1.DisplayLayout.FrameStyle.CustomRules = "table-layout:auto";
UltraWebGrid1.Bands[1].Expandable = Infragistics.WebUI.UltraWebGrid.Expandable.Yes;
odb.LoadEMPGD(UltraWebGrid1);
odb.LoadRolesGD(UltraWebGrid1);
odb.LoadRoledetailsGD(UltraWebGrid1);
}
}
#region Web Form Designer generated code
override protected void OnInit(EventArgs e)
{
//
// CODEGEN: This call is required by the ASP.NET Web Form Designer.
//
InitializeComponent();
base.OnInit(e);
}
///
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
///
private void InitializeComponent()
{
this.Unload += new System.EventHandler(this.Services_Unload);
this.Load += new System.EventHandler(this.Page_Load);
this.Init += new System.EventHandler(this.Services_Init);
}
#endregion
private void Services_Init(object sender, System.EventArgs e)
{
string strConnInfo = Application.Contents["ConnectionInfo"].ToString();
odb = new cmaDBInterface();
odb.OpenStagingDatabase(strConnInfo);
}
private void Services_Unload(object sender, System.EventArgs e)
{
odb.CloseStagingDatabase();
}
}
}
cmadbinterface methods..
public void LoadEMPGD(Infragistics.WebUI.UltraWebGrid.UltraWebGrid argGrid)
{
int nID = -9999;
string sqlQuery = "Select Employee_ID, First_Name + ' ' + Last_Name as 'Name' FROM employees";
argGrid.Rows.Clear();
System.Data.SqlClient.SqlDataReader myReader = null;
try
{
System.Data.SqlClient.SqlCommand myCommand = new System.Data.SqlClient.SqlCommand(sqlQuery, myConn);
myReader = myCommand.ExecuteReader();
while (myReader.Read())
{
Infragistics.WebUI.UltraWebGrid.UltraGridRow myRow = new Infragistics.WebUI.UltraWebGrid.UltraGridRow(true);
nID = myReader.GetInt32(0);
string Service_Desc = (myReader.IsDBNull(1) ? "" : myReader.GetString(1));
Infragistics.WebUI.UltraWebGrid.UltraGridCell Cell0 = new Infragistics.WebUI.UltraWebGrid.UltraGridCell(Service_Desc);
myRow.Key = nID.ToString();
myRow.Cells.Add(Cell0);
argGrid.Rows.Add(myRow);
}
}
catch (Exception e)
{
System.Diagnostics.Debug.WriteLine(e.Source);
System.Diagnostics.Debug.WriteLine(e.Message);
}
finally
{
myReader.Close();
}
}
public void LoadRolesGD(Infragistics.WebUI.UltraWebGrid.UltraWebGrid argGrid)
{
int Role_ID = -1;
string strQuery = "select R.Role_ID,R.Role_name from Employees E INNER JOIN Employee_Roles ER ON E.Employee_id = ER.Employee_id INNER JOIN Role R ON ER.Role_ID = R.Role_ID AND E.Employee_id = @Employee_ID";
try
{
System.Data.SqlClient.SqlCommand myCommand = new System.Data.SqlClient.SqlCommand(strQuery, myConn);
myCommand.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Employee_ID", System.Data.SqlDbType.Int, 4));
foreach (Infragistics.WebUI.UltraWebGrid.UltraGridRow eventrow in argGrid.Rows)
{
eventrow.Rows.Clear();
myCommand.Parameters["@Employee_ID"].Value = Int32.Parse(eventrow.Key);
System.Data.SqlClient.SqlDataReader myReader = null;
myReader = myCommand.ExecuteReader();
while (myReader.Read())
{
Infragistics.WebUI.UltraWebGrid.UltraGridRow myRow = new Infragistics.WebUI.UltraWebGrid.UltraGridRow(true);
Role_ID = myReader.GetInt32(0);
bool Active = true;
string Role_Name = (myReader.IsDBNull(1) ? "" : myReader.GetString(1));
Infragistics.WebUI.UltraWebGrid.UltraGridCell Cell1 = new Infragistics.WebUI.UltraWebGrid.UltraGridCell(Active.ToString());
Infragistics.WebUI.UltraWebGrid.UltraGridCell Cell2 = new Infragistics.WebUI.UltraWebGrid.UltraGridCell(Role_Name);
myRow.Key = Role_ID.ToString();
// myRow.Key = (nServiceID * 1000 + eventrow.Rows.Count + 1).ToString();
myRow.Cells.Add(Cell1);
myRow.Cells.Add(Cell2);
eventrow.Rows.Add(myRow);
}
myReader.Close();
}
}
catch (Exception e)
{
System.Diagnostics.Debug.WriteLine(e.Source);
System.Diagnostics.Debug.WriteLine(e.Message);
}
// finally
// {
// myReader.Close();
// }
}
public void LoadRoledetailsGD(Infragistics.WebUI.UltraWebGrid.UltraWebGrid argGrid)
{
int Role_Id = -1;
int RolerowPID = -1;
string strQuery = "Select Role_ID,Role_Name, PrimaryRole FROM Role where Role_Id=@Role_Id";
try
{
System.Data.SqlClient.SqlCommand myCommand = new System.Data.SqlClient.SqlCommand(strQuery, myConn);
myCommand.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Role_Id", System.Data.SqlDbType.Int, 4));
foreach (Infragistics.WebUI.UltraWebGrid.UltraGridRow Empployeesrows in argGrid.Rows)
{
foreach (Infragistics.WebUI.UltraWebGrid.UltraGridRow Rolerow in Empployeesrows.Rows)
{
Role_Id = Convert.ToInt32(Rolerow.Key);
myCommand.Parameters["@Role_Id"].Value = Role_Id;
Rolerow.Rows.Clear();
System.Data.SqlClient.SqlDataReader myReader = null;
myReader = myCommand.ExecuteReader();
while (myReader.Read())
{
Infragistics.WebUI.UltraWebGrid.UltraGridRow myRow = new Infragistics.WebUI.UltraWebGrid.UltraGridRow(true);
RolerowPID = myReader.GetInt32(0);
myRow.Key = RolerowPID.ToString();
string RoleDesc = (myReader.IsDBNull(1) ? "" : myReader.GetString(1));
bool isPrimary = (myReader.IsDBNull(2) ? false : Convert.ToBoolean(myReader.GetByte(2)));
Infragistics.WebUI.UltraWebGrid.UltraGridCell Cell0 = new Infragistics.WebUI.UltraWebGrid.UltraGridCell();
Cell0.Value = RoleDesc;
Infragistics.WebUI.UltraWebGrid.UltraGridCell Cell1 = new Infragistics.WebUI.UltraWebGrid.UltraGridCell(Convert.ToInt32(isPrimary));
myRow.Cells.Add(Cell0);
myRow.Cells.Add(Cell1);
Rolerow.Rows.Add(myRow);
}
myReader.Close();
}
}
}
catch (Exception e)
{
System.Diagnostics.Debug.WriteLine(e.Source);
System.Diagnostics.Debug.WriteLine(e.Message);
}
// finally
// {
//
// myReader.Close();
// }
}
Grid with first column as checkbox
first column a checkbox.. other features from code below..
(%@ Page language="c#" Codebehind="testpage.aspx.cs" AutoEventWireup="false" Inherits="bms.testpage" %)
(%@ Register TagPrefix="igtbl" Namespace="Infragistics.WebUI.UltraWebGrid" Assembly="Infragistics.WebUI.UltraWebGrid.v6.3, Version=6.3.20063.53, Culture=neutral, PublicKeyToken=7dd5c3163f2cd0cb" %)
(!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" )
(HTML)
(HEAD)
(title)testpage(/title)
(meta content="Microsoft Visual Studio .NET 7.1" name="GENERATOR")
(meta content="C#" name="CODE_LANGUAGE")
(meta content="JavaScript" name="vs_defaultClientScript")
(meta content="http://schemas.microsoft.com/intellisense/ie5" name="vs_targetSchema")
(LINK href="/ig_common/20063/Styles/Office2007Silver/ig_WebGrid.css " type="text/css"
rel="Stylesheet")
(/HEAD)
(body XMLNS:igtbl="http://schemas.infragistics.com/ASPNET/WebControls/UltraWebGrid" MS_POSITIONING="GridLayout")
(form id="Form1" method="post" runat="server")
(table border="1")
(tr)
(td)(igtbl:ultrawebgrid id="ig" runat="server" ImageDirectory="/ig_common/20063/Styles/Office2007Silver/WebGrid/")
(DisplayLayout ColWidthDefault="" CompactRendering="False" RowSizingDefault="Free" StationaryMargins="Header"
AllowSortingDefault="OnClient" RowHeightDefault="20px" Version="4.00" ViewType="OutlookGroupBy"
SelectTypeRowDefault="Extended" HeaderClickActionDefault="SortSingle" BorderCollapseDefault="Separate"
AllowColSizingDefault="Free" Name="ig" TableLayout="Fixed" CellClickActionDefault="RowSelect"
AllowUpdateDefault="Yes")
(AddNewBox)
(Style CssClass="igwgAddNewBoxSilver2k7")(/Style)
(ButtonStyle CssClass="igwgAddNewBtnSilver2k7")(/ButtonStyle)
(/AddNewBox)
(Pager)
(Style CssClass="igwgPgrSilver2k7")(/Style)
(/Pager)
(HeaderStyleDefault BackColor="Azure" Height="40px" Wrap="True")(/HeaderStyleDefault)
(FormulaErrorStyleDefault CssClass="igwgFormulaErrSilver2k7")(/FormulaErrorStyleDefault)
(GroupByRowStyleDefault CssClass="igwgGrpRowSilver2k7")(/GroupByRowStyleDefault)
(RowSelectorStyleDefault CssClass="igwgRowSlctrSilver2k7")(/RowSelectorStyleDefault)
(FrameStyle CssClass="igwgFrameSilver2k7")(/FrameStyle)
(FilterOptionsDefault DropDownRowCount="15")
(FilterHighlightRowStyle CssClass="igwgFltrRowHiLtSilver2k7")(/FilterHighlightRowStyle)
(FilterDropDownStyle CssClass="igwgFltrDrpDwnSilver2k7")(/FilterDropDownStyle)
(/FilterOptionsDefault)
(FooterStyleDefault CssClass="igwgFooterSilver2k7")(/FooterStyleDefault)
(ClientSideEvents AfterCellUpdateHandler="ig_AfterCellUpdateHandler")(/ClientSideEvents)
(ActivationObject BorderColor="181, 196, 223")
(BorderDetails WidthLeft="0px" WidthRight="0px")(/BorderDetails)
(/ActivationObject)
(GroupByBox)
(Style CssClass="igwgGrpBoxSilver2k7")(/Style)
(BandLabelStyle CssClass="igwgGrpBoxBandLblSilver2k7")(/BandLabelStyle)
(/GroupByBox)
(Images ImageDirectory="/ig_common/20063/Styles/Office2007Silver/WebGrid/" /)
(RowExpAreaStyleDefault CssClass="igwgRowExpSilver2k7")(/RowExpAreaStyleDefault)
(SelectedHeaderStyleDefault CssClass="igwgHdrSelSilver2k7")(/SelectedHeaderStyleDefault)
(FixedHeaderStyleDefault CssClass="igwgHdrFxdSilver2k7")(/FixedHeaderStyleDefault)
(EditCellStyleDefault CssClass="igwgCellEdtSilver2k7")(/EditCellStyleDefault)
(FixedFooterStyleDefault CssClass="igwgFtrFxdSilver2k7")(/FixedFooterStyleDefault)
(SelectedGroupByRowStyleDefault CssClass="igwgGrpRowSelSilver2k7")(/SelectedGroupByRowStyleDefault)
(SelectedRowStyleDefault CssClass="igwgRowSelSilver2k7")(/SelectedRowStyleDefault)
(RowAlternateStyleDefault CssClass="igwgRowAltSilver2k7")(/RowAlternateStyleDefault)
(RowStyleDefault CssClass="igwgRowSilver2k7")
(Padding Left="3px")(/Padding)
(/RowStyleDefault)
(FixedCellStyleDefault CssClass="igwgCellFxdSilver2k7")(/FixedCellStyleDefault)
(/DisplayLayout)
(Bands)
(igtbl:UltraGridBand)
(Columns)
(igtbl:UltraGridColumn HeaderText="Check" Width="60px" AllowUpdate="Yes" Type="CheckBox")
(CellStyle HorizontalAlign="Center")(/CellStyle)
(Footer Key="")(/Footer)
(Header Key="" Caption="Check")(/Header)
(/igtbl:UltraGridColumn)
(igtbl:UltraGridColumn HeaderText="Active" Width="60px" AllowUpdate="Yes" Type="CheckBox")
(CellStyle HorizontalAlign="Center")(/CellStyle)
(Footer Key="")(/Footer)
(Header Key="" Caption="Active")(/Header)
(/igtbl:UltraGridColumn)
(igtbl:UltraGridColumn HeaderText="Targeted" Width="80px" AllowUpdate="Yes" Type="CheckBox" AllowResize="Free")
(CellStyle HorizontalAlign="Center")(/CellStyle)
(Footer Key="")
(RowLayoutColumnInfo OriginX="1")(/RowLayoutColumnInfo)
(/Footer)
(Header Key="" Caption="Targeted")
(RowLayoutColumnInfo OriginX="1")(/RowLayoutColumnInfo)
(/Header)
(/igtbl:UltraGridColumn)
(igtbl:UltraGridColumn HeaderText="Category" Width="170px" AllowUpdate="No" AllowResize="Free")
(CellStyle HorizontalAlign="Center")(/CellStyle)
(Footer Key="")
(RowLayoutColumnInfo OriginX="2")(/RowLayoutColumnInfo)
(/Footer)
(Header Key="" Caption="Category")
(RowLayoutColumnInfo OriginX="2")(/RowLayoutColumnInfo)
(/Header)
(/igtbl:UltraGridColumn)
(igtbl:UltraGridColumn HeaderText="Lead Scale (5=Good,1=Bad)" Width="112px" AllowUpdate="Yes" Type="DropDownList" AllowResize="Free")
(Footer Key="")
(RowLayoutColumnInfo OriginX="3")(/RowLayoutColumnInfo)
(/Footer)
(Header Key="" Caption="Lead Scale (5=Good,1=Bad)")
(RowLayoutColumnInfo OriginX="3")(/RowLayoutColumnInfo)
(/Header)
(/igtbl:UltraGridColumn)
(igtbl:UltraGridColumn HeaderText="Comments" Width="230px" AllowUpdate="Yes" AllowResize="Free")
(Footer Key="")
(RowLayoutColumnInfo OriginX="4")(/RowLayoutColumnInfo)
(/Footer)
(Header Key="" Caption="Comments")
(RowLayoutColumnInfo OriginX="4")(/RowLayoutColumnInfo)
(/Header)
(/igtbl:UltraGridColumn)
(/Columns)
(/igtbl:UltraGridBand)
(/Bands)
(/igtbl:ultrawebgrid)(/td)
(/tr)
(tr)
(td)(asp:button id="Button1" runat="server" Text="Get value")(/asp:button)
(asp:button id="Button2" runat="server" Text="Load")(/asp:button)(/td)
(/tr)
(/table)
(/form)
(/body)
(/HTML)
#region using
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using System.IO;
using System.Text;
using BMSQBInterface;
using bmsFramework.MyAccount;
using Infragistics.WebUI.UltraWebGrid;
#endregion
namespace bms
{
///
/// Summary description for testpage.
///
public class testpage : System.Web.UI.Page
{
protected BMSQBServer bmsQBServer = null;
protected DBConnection dbc;
protected cmaDBInterface odb;
protected System.Web.UI.WebControls.Button Button1;
protected System.Web.UI.WebControls.Button Button2;
protected Infragistics.WebUI.UltraWebGrid.UltraWebGrid ig;
protected System.Data.SqlClient.SqlConnection myConn;
private void Page_Load(object sender, System.EventArgs e)
{
if(!Page.IsPostBack)
{
LoadValueList(ig.Columns[4], "PreSales_Lead", "PreSales_Lead_Id", "PreSales_Lead_Desc");
ig.Columns[4].CellStyle.Font.Name = "Arial";
ig.Columns[4].CellStyle.Font.Size = FontUnit.Point(8);
ig.Width = Unit.Empty;
ig.Height = Unit.Empty;
ig.DisplayLayout.FrameStyle.CustomRules = "table-layout:auto";
LoadCustomerLeads(ig, 400);
}
}
public void LoadValueList(Infragistics.WebUI.UltraWebGrid.UltraGridColumn argColumn, string argTable, string argIDCol, string argNameCol)
{
LoadValueList(argColumn, argTable, argIDCol, argNameCol, "", true);
}
public void LoadValueList(Infragistics.WebUI.UltraWebGrid.UltraGridColumn argColumn, string argTable, string argIDCol, string argNameCol, string argFilter, bool bIncludeNone)
{
dbc = new DBConnection();
string strConnInfo = Application.Contents["ConnectionInfo"].ToString();
myConn = dbc.OpenDatabase(strConnInfo);
Infragistics.WebUI.UltraWebGrid.ValueList argVL = argColumn.ValueList;
StringBuilder sb = new StringBuilder("SELECT ");
sb.Append(argIDCol);
sb.Append(", ");
sb.Append(argNameCol);
sb.Append(" from ");
sb.Append(argTable);
if (argFilter != "")
{
sb.Append(" WHERE ");
sb.Append(argFilter);
}
int nID = -1;
argVL.ValueListItems.Clear();
if (bIncludeNone)
{
argVL.ValueListItems.Add(nID, "NONE");
argVL.ValueListItems[0].Key = nID.ToString();
}
System.Data.SqlClient.SqlDataReader myReader = null;
try
{
System.Data.SqlClient.SqlCommand myCommand = new System.Data.SqlClient.SqlCommand(sb.ToString(), myConn);
myReader = myCommand.ExecuteReader();
while (myReader.Read())
{
nID = myReader.GetInt32(0);
string strName = myReader.GetString(1);
Infragistics.WebUI.UltraWebGrid.ValueListItem item = new Infragistics.WebUI.UltraWebGrid.ValueListItem(strName, nID.ToString());
item.Key = nID.ToString();
argVL.ValueListItems.Add(item);
}
}
catch (Exception e)
{
System.Diagnostics.Debug.WriteLine(e.Source);
System.Diagnostics.Debug.WriteLine(e.Message);
}
finally
{
myReader.Close();
}
}
public void LoadCustomerLeads(Infragistics.WebUI.UltraWebGrid.UltraWebGrid argGrid, int argCustomerID)
{
dbc = new DBConnection();
string strConnInfo = Application.Contents["ConnectionInfo"].ToString();
myConn = dbc.OpenDatabase(strConnInfo);
int nID = -9999;
int nLead = -999;
string sqlQuery = "ReadCustomerLeads";
argGrid.Rows.Clear();
System.Data.SqlClient.SqlDataReader myReader = null;
try
{
System.Data.SqlClient.SqlCommand myCommand = new System.Data.SqlClient.SqlCommand(sqlQuery, myConn);
myCommand.CommandType = System.Data.CommandType.StoredProcedure;
myCommand.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Customer_ID", System.Data.SqlDbType.Int));
myCommand.Parameters["@Customer_ID"].Value = argCustomerID;
myReader = myCommand.ExecuteReader();
while (myReader.Read())
{
Infragistics.WebUI.UltraWebGrid.UltraGridRow myRow = new Infragistics.WebUI.UltraWebGrid.UltraGridRow(true);
nID = myReader.GetInt32(0);
string Desc = (myReader.IsDBNull(1) ? "" : myReader.GetString(1));
nLead = (myReader.IsDBNull(2) ? -1 : myReader.GetInt32(2));
string Comments = (myReader.IsDBNull(3) ? "" : myReader.GetString(3));
bool Active = (myReader.IsDBNull(4) ? false : myReader.GetBoolean(4));
bool bInterest = myReader.IsDBNull(5) ? false : myReader.GetBoolean(5);
int ActiveContract = (Convert.IsDBNull(myReader["ActiveContract"]) ? 0 : Convert.ToInt32(myReader["ActiveContract"].ToString()));
myRow.Key = nID.ToString();
Infragistics.WebUI.UltraWebGrid.UltraGridCell checkCell = new Infragistics.WebUI.UltraWebGrid.UltraGridCell();
checkCell.Value = false;
myRow.Cells.Add(checkCell);
Infragistics.WebUI.UltraWebGrid.UltraGridCell activeCell = new Infragistics.WebUI.UltraWebGrid.UltraGridCell();
activeCell.Value = Active;
if (ActiveContract == 1)
{
activeCell.AllowEditing = Infragistics.WebUI.UltraWebGrid.AllowEditing.No;
activeCell.Value = 1;
activeCell.Style.BorderColor = System.Drawing.Color.Gray;
}
else
{
activeCell.AllowEditing = Infragistics.WebUI.UltraWebGrid.AllowEditing.Yes;
// activeCell.Style.BorderColor = System.Drawing.Color.Black;
}
myRow.Cells.Add(activeCell);
Infragistics.WebUI.UltraWebGrid.UltraGridCell interestCell = new Infragistics.WebUI.UltraWebGrid.UltraGridCell();
interestCell.Value = true;
myRow.Cells.Add(interestCell);
myRow.Cells.Add(new Infragistics.WebUI.UltraWebGrid.UltraGridCell(Desc));
Infragistics.WebUI.UltraWebGrid.UltraGridCell LeadCell = new Infragistics.WebUI.UltraWebGrid.UltraGridCell();
LeadCell.Value = nLead;
myRow.Cells.Add(LeadCell);
myRow.Cells.Add(new Infragistics.WebUI.UltraWebGrid.UltraGridCell(Comments));
argGrid.Rows.Add(myRow);
}
}
catch (Exception e)
{
System.Diagnostics.Debug.WriteLine(e.Source);
System.Diagnostics.Debug.WriteLine(e.Message);
}
finally
{
myReader.Close();
}
}
#region Web Form Designer generated code
override protected void OnInit(EventArgs e)
{
//
// CODEGEN: This call is required by the ASP.NET Web Form Designer.
//
InitializeComponent();
base.OnInit(e);
}
///
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
///
private void InitializeComponent()
{
this.Button1.Click += new System.EventHandler(this.Button1_Click);
this.Load += new System.EventHandler(this.Page_Load);
this.ig.InitializeLayout += new Infragistics.WebUI.UltraWebGrid.InitializeLayoutEventHandler(this.ig_InitializeLayout);
}
#endregion
private void ig_InitializeLayout(object sender, Infragistics.WebUI.UltraWebGrid.LayoutEventArgs e)
{
//Name column for employee
//ig.Columns[4].CellButtonStyle.Font.Name = "Verdana";
//ig.Columns[4].CellButtonStyle.Font.Size = FontUnit.Point(12);
}
private void Button1_Click(object sender, System.EventArgs e)
{
foreach(Infragistics.WebUI.UltraWebGrid.UltraGridRow row in ig.Rows)
{
Response.Write("Active cell value is : " + row.Cells[0].Value.ToString() + "
");
// myCmd.Parameters["@PreSales_Category_Id"].Value = Int32.Parse(row.Key);
// myCmd.Parameters["@Active"].Value = row.Cells[0].Value;
// myCmd.Parameters["@Interest"].Value = row.Cells[1].Value;
// myCmd.Parameters["@Lead_Id"].Value = Convert.ToInt32(row.Cells[3].Value);
// myCmd.Parameters["@Comments"].Value = (row.Cells[4].Text == null) ? String.Empty : row.Cells[4].Text.Trim();
//
// myCmd.ExecuteNonQuery();
}
}
}
}
Grid with custom grouping, checkbox and dropdowns
paticipation grid with an option to drop a header
Additional features include.
- gird with checkbox n dropdown withd data in it..
- btn click get column 1 value
(%@ Register TagPrefix="igtbl" Namespace="Infragistics.WebUI.UltraWebGrid" Assembly="Infragistics.WebUI.UltraWebGrid.v6.3, Version=6.3.20063.53, Culture=neutral, PublicKeyToken=7dd5c3163f2cd0cb" %)
(!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" )
(HTML)
(HEAD)
(title)testpage(/title)
(meta content="Microsoft Visual Studio .NET 7.1" name="GENERATOR")
(meta content="C#" name="CODE_LANGUAGE")
(meta content="JavaScript" name="vs_defaultClientScript")
(meta content="http://schemas.microsoft.com/intellisense/ie5" name="vs_targetSchema")
(LINK href="/ig_common/20063/Styles/Office2007Silver/ig_WebGrid.css " type="text/css"
rel="Stylesheet")
(/HEAD)
(body XMLNS:igtbl="http://schemas.infragistics.com/ASPNET/WebControls/UltraWebGrid" MS_POSITIONING="GridLayout")
(form id="Form1" method="post" runat="server")
(table border="1")
(tr)
(td)(igtbl:ultrawebgrid id="ig" runat="server" ImageDirectory="/ig_common/20063/Styles/Office2007Silver/WebGrid/")
(DisplayLayout ColWidthDefault="" CompactRendering="False" RowSizingDefault="Free" StationaryMargins="Header"
AllowSortingDefault="OnClient" RowHeightDefault="20px" Version="4.00" ViewType="OutlookGroupBy"
SelectTypeRowDefault="Extended" HeaderClickActionDefault="SortSingle" BorderCollapseDefault="Separate"
AllowColSizingDefault="Free" Name="ig" TableLayout="Fixed" CellClickActionDefault="RowSelect"
AllowUpdateDefault="Yes")
(AddNewBox)
(Style CssClass="igwgAddNewBoxSilver2k7")(/Style)
(ButtonStyle CssClass="igwgAddNewBtnSilver2k7")(/ButtonStyle)
(/AddNewBox)
(Pager)
(Style CssClass="igwgPgrSilver2k7")(/Style)
(/Pager)
(HeaderStyleDefault BackColor="Azure" Height="40px" Wrap="True")(/HeaderStyleDefault)
(FormulaErrorStyleDefault CssClass="igwgFormulaErrSilver2k7")(/FormulaErrorStyleDefault)
(GroupByRowStyleDefault CssClass="igwgGrpRowSilver2k7")(/GroupByRowStyleDefault)
(RowSelectorStyleDefault CssClass="igwgRowSlctrSilver2k7")(/RowSelectorStyleDefault)
(FrameStyle CssClass="igwgFrameSilver2k7")(/FrameStyle)
(FilterOptionsDefault DropDownRowCount="15")
(FilterHighlightRowStyle CssClass="igwgFltrRowHiLtSilver2k7")(/FilterHighlightRowStyle)
(FilterDropDownStyle CssClass="igwgFltrDrpDwnSilver2k7")(/FilterDropDownStyle)
(/FilterOptionsDefault)
(FooterStyleDefault CssClass="igwgFooterSilver2k7")(/FooterStyleDefault)
(ClientSideEvents AfterCellUpdateHandler="ig_AfterCellUpdateHandler")(/ClientSideEvents)
(ActivationObject BorderColor="181, 196, 223")
(BorderDetails WidthLeft="0px" WidthRight="0px")(/BorderDetails)
(/ActivationObject)
(GroupByBox)
(Style CssClass="igwgGrpBoxSilver2k7")(/Style)
(BandLabelStyle CssClass="igwgGrpBoxBandLblSilver2k7")(/BandLabelStyle)
(/GroupByBox)
(Images ImageDirectory="/ig_common/20063/Styles/Office2007Silver/WebGrid/" /)
(RowExpAreaStyleDefault CssClass="igwgRowExpSilver2k7")(/RowExpAreaStyleDefault)
(SelectedHeaderStyleDefault CssClass="igwgHdrSelSilver2k7")(/SelectedHeaderStyleDefault)
(FixedHeaderStyleDefault CssClass="igwgHdrFxdSilver2k7")(/FixedHeaderStyleDefault)
(EditCellStyleDefault CssClass="igwgCellEdtSilver2k7")(/EditCellStyleDefault)
(FixedFooterStyleDefault CssClass="igwgFtrFxdSilver2k7")(/FixedFooterStyleDefault)
(SelectedGroupByRowStyleDefault CssClass="igwgGrpRowSelSilver2k7")(/SelectedGroupByRowStyleDefault)
(SelectedRowStyleDefault CssClass="igwgRowSelSilver2k7")(/SelectedRowStyleDefault)
(RowAlternateStyleDefault CssClass="igwgRowAltSilver2k7")(/RowAlternateStyleDefault)
(RowStyleDefault CssClass="igwgRowSilver2k7")
(Padding Left="3px")(/Padding)
(/RowStyleDefault)
(FixedCellStyleDefault CssClass="igwgCellFxdSilver2k7")(/FixedCellStyleDefault)
(/DisplayLayout)
(Bands)
(igtbl:UltraGridBand)
(Columns)
(igtbl:UltraGridColumn HeaderText="Active" Width="60px" AllowUpdate="Yes" Type="CheckBox")
(CellStyle HorizontalAlign="Center")(/CellStyle)
(Footer Key="")(/Footer)
(Header Key="" Caption="Active")(/Header)
(/igtbl:UltraGridColumn)
(igtbl:UltraGridColumn HeaderText="Targeted" Width="80px" AllowUpdate="Yes" Type="CheckBox" AllowResize="Free")
(CellStyle HorizontalAlign="Center")(/CellStyle)
(Footer Key="")
(RowLayoutColumnInfo OriginX="1")(/RowLayoutColumnInfo)
(/Footer)
(Header Key="" Caption="Targeted")
(RowLayoutColumnInfo OriginX="1")(/RowLayoutColumnInfo)
(/Header)
(/igtbl:UltraGridColumn)
(igtbl:UltraGridColumn HeaderText="Category" Width="170px" AllowUpdate="No" AllowResize="Free")
(CellStyle HorizontalAlign="Center")(/CellStyle)
(Footer Key="")
(RowLayoutColumnInfo OriginX="2")(/RowLayoutColumnInfo)
(/Footer)
(Header Key="" Caption="Category")
(RowLayoutColumnInfo OriginX="2")(/RowLayoutColumnInfo)
(/Header)
(/igtbl:UltraGridColumn)
(igtbl:UltraGridColumn HeaderText="Lead Scale (5=Good,1=Bad)" Width="112px" AllowUpdate="Yes" Type="DropDownList" AllowResize="Free")
(Footer Key="")
(RowLayoutColumnInfo OriginX="3")(/RowLayoutColumnInfo)
(/Footer)
(Header Key="" Caption="Lead Scale (5=Good,1=Bad)")
(RowLayoutColumnInfo OriginX="3")(/RowLayoutColumnInfo)
(/Header)
(/igtbl:UltraGridColumn)
(igtbl:UltraGridColumn HeaderText="Comments" Width="230px" AllowUpdate="Yes" AllowResize="Free")
(Footer Key="")
(RowLayoutColumnInfo OriginX="4")(/RowLayoutColumnInfo)
(/Footer)
(Header Key="" Caption="Comments")
(RowLayoutColumnInfo OriginX="4")(/RowLayoutColumnInfo)
(/Header)
(/igtbl:UltraGridColumn)
(/Columns)
(/igtbl:UltraGridBand)
(/Bands)
(/igtbl:ultrawebgrid)(/td)
(/tr)
(tr)
(td)(asp:button id="Button1" runat="server" Text="Get value")(/asp:button)
(asp:button id="Button2" runat="server" Text="Load")(/asp:button)(/td)
(/tr)
(/table)
(/form)
(/body)
(/HTML)
#region using
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using System.IO;
using System.Text;
using BMSQBInterface;
using bmsFramework.MyAccount;
using Infragistics.WebUI.UltraWebGrid;
#endregion
namespace bms
{
///
/// Summary description for testpage.
///
public class testpage : System.Web.UI.Page
{
protected BMSQBServer bmsQBServer = null;
protected DBConnection dbc;
protected cmaDBInterface odb;
protected System.Web.UI.WebControls.Button Button1;
protected System.Web.UI.WebControls.Button Button2;
protected Infragistics.WebUI.UltraWebGrid.UltraWebGrid ig;
protected System.Data.SqlClient.SqlConnection myConn;
private void Page_Load(object sender, System.EventArgs e)
{
if(!Page.IsPostBack)
{
LoadValueList(ig.Columns[3], "PreSales_Lead", "PreSales_Lead_Id", "PreSales_Lead_Desc");
ig.Columns[3].CellStyle.Font.Name = "Arial";
ig.Columns[3].CellStyle.Font.Size = FontUnit.Point(8);
ig.Width = Unit.Empty;
ig.Height = Unit.Empty;
ig.DisplayLayout.FrameStyle.CustomRules = "table-layout:auto";
LoadCustomerLeads(ig, 400);
}
}
public void LoadValueList(Infragistics.WebUI.UltraWebGrid.UltraGridColumn argColumn, string argTable, string argIDCol, string argNameCol)
{
LoadValueList(argColumn, argTable, argIDCol, argNameCol, "", true);
}
public void LoadValueList(Infragistics.WebUI.UltraWebGrid.UltraGridColumn argColumn, string argTable, string argIDCol, string argNameCol, string argFilter, bool bIncludeNone)
{
dbc = new DBConnection();
string strConnInfo = Application.Contents["ConnectionInfo"].ToString();
myConn = dbc.OpenDatabase(strConnInfo);
Infragistics.WebUI.UltraWebGrid.ValueList argVL = argColumn.ValueList;
StringBuilder sb = new StringBuilder("SELECT ");
sb.Append(argIDCol);
sb.Append(", ");
sb.Append(argNameCol);
sb.Append(" from ");
sb.Append(argTable);
if (argFilter != "")
{
sb.Append(" WHERE ");
sb.Append(argFilter);
}
int nID = -1;
argVL.ValueListItems.Clear();
if (bIncludeNone)
{
argVL.ValueListItems.Add(nID, "NONE");
argVL.ValueListItems[0].Key = nID.ToString();
}
System.Data.SqlClient.SqlDataReader myReader = null;
try
{
System.Data.SqlClient.SqlCommand myCommand = new System.Data.SqlClient.SqlCommand(sb.ToString(), myConn);
myReader = myCommand.ExecuteReader();
while (myReader.Read())
{
nID = myReader.GetInt32(0);
string strName = myReader.GetString(1);
Infragistics.WebUI.UltraWebGrid.ValueListItem item = new Infragistics.WebUI.UltraWebGrid.ValueListItem(strName, nID.ToString());
item.Key = nID.ToString();
argVL.ValueListItems.Add(item);
}
}
catch (Exception e)
{
System.Diagnostics.Debug.WriteLine(e.Source);
System.Diagnostics.Debug.WriteLine(e.Message);
}
finally
{
myReader.Close();
}
}
public void LoadCustomerLeads(Infragistics.WebUI.UltraWebGrid.UltraWebGrid argGrid, int argCustomerID)
{
dbc = new DBConnection();
string strConnInfo = Application.Contents["ConnectionInfo"].ToString();
myConn = dbc.OpenDatabase(strConnInfo);
int nID = -9999;
int nLead = -999;
string sqlQuery = "ReadCustomerLeads";
argGrid.Rows.Clear();
System.Data.SqlClient.SqlDataReader myReader = null;
try
{
System.Data.SqlClient.SqlCommand myCommand = new System.Data.SqlClient.SqlCommand(sqlQuery, myConn);
myCommand.CommandType = System.Data.CommandType.StoredProcedure;
myCommand.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Customer_ID", System.Data.SqlDbType.Int));
myCommand.Parameters["@Customer_ID"].Value = argCustomerID;
myReader = myCommand.ExecuteReader();
while (myReader.Read())
{
Infragistics.WebUI.UltraWebGrid.UltraGridRow myRow = new Infragistics.WebUI.UltraWebGrid.UltraGridRow(true);
nID = myReader.GetInt32(0);
string Desc = (myReader.IsDBNull(1) ? "" : myReader.GetString(1));
nLead = (myReader.IsDBNull(2) ? -1 : myReader.GetInt32(2));
string Comments = (myReader.IsDBNull(3) ? "" : myReader.GetString(3));
bool Active = (myReader.IsDBNull(4) ? false : myReader.GetBoolean(4));
bool bInterest = myReader.IsDBNull(5) ? false : myReader.GetBoolean(5);
int ActiveContract = (Convert.IsDBNull(myReader["ActiveContract"]) ? 0 : Convert.ToInt32(myReader["ActiveContract"].ToString()));
myRow.Key = nID.ToString();
Infragistics.WebUI.UltraWebGrid.UltraGridCell activeCell = new Infragistics.WebUI.UltraWebGrid.UltraGridCell();
activeCell.Value = Active;
if (ActiveContract == 1)
{
activeCell.AllowEditing = Infragistics.WebUI.UltraWebGrid.AllowEditing.No;
activeCell.Value = 1;
activeCell.Style.BorderColor = System.Drawing.Color.Gray;
}
else
{
activeCell.AllowEditing = Infragistics.WebUI.UltraWebGrid.AllowEditing.Yes;
// activeCell.Style.BorderColor = System.Drawing.Color.Black;
}
myRow.Cells.Add(activeCell);
Infragistics.WebUI.UltraWebGrid.UltraGridCell interestCell = new Infragistics.WebUI.UltraWebGrid.UltraGridCell();
interestCell.Value = true;
myRow.Cells.Add(interestCell);
myRow.Cells.Add(new Infragistics.WebUI.UltraWebGrid.UltraGridCell(Desc));
Infragistics.WebUI.UltraWebGrid.UltraGridCell LeadCell = new Infragistics.WebUI.UltraWebGrid.UltraGridCell();
LeadCell.Value = nLead;
myRow.Cells.Add(LeadCell);
myRow.Cells.Add(new Infragistics.WebUI.UltraWebGrid.UltraGridCell(Comments));
argGrid.Rows.Add(myRow);
}
}
catch (Exception e)
{
System.Diagnostics.Debug.WriteLine(e.Source);
System.Diagnostics.Debug.WriteLine(e.Message);
}
finally
{
myReader.Close();
}
}
#region Web Form Designer generated code
override protected void OnInit(EventArgs e)
{
//
// CODEGEN: This call is required by the ASP.NET Web Form Designer.
//
InitializeComponent();
base.OnInit(e);
}
///
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
///
private void InitializeComponent()
{
this.Button1.Click += new System.EventHandler(this.Button1_Click);
this.Load += new System.EventHandler(this.Page_Load);
this.ig.InitializeLayout += new Infragistics.WebUI.UltraWebGrid.InitializeLayoutEventHandler(this.ig_InitializeLayout);
}
#endregion
private void ig_InitializeLayout(object sender, Infragistics.WebUI.UltraWebGrid.LayoutEventArgs e)
{
//Name column for employee
//ig.Columns[4].CellButtonStyle.Font.Name = "Verdana";
//ig.Columns[4].CellButtonStyle.Font.Size = FontUnit.Point(12);
}
private void Button1_Click(object sender, System.EventArgs e)
{
foreach(Infragistics.WebUI.UltraWebGrid.UltraGridRow row in ig.Rows)
{
Response.Write("Active cell value is : " + row.Cells[0].Value.ToString() + "
");
// myCmd.Parameters["@PreSales_Category_Id"].Value = Int32.Parse(row.Key);
// myCmd.Parameters["@Active"].Value = row.Cells[0].Value;
// myCmd.Parameters["@Interest"].Value = row.Cells[1].Value;
// myCmd.Parameters["@Lead_Id"].Value = Convert.ToInt32(row.Cells[3].Value);
// myCmd.Parameters["@Comments"].Value = (row.Cells[4].Text == null) ? String.Empty : row.Cells[4].Text.Trim();
//
// myCmd.ExecuteNonQuery();
}
}
}
}
Friday, August 1, 2008
Infragistics grid basics
The example shows you how to create a ultrawebgrid (6.3 version) with the following features
(%@ Register TagPrefix="igtbl" Namespace="Infragistics.WebUI.UltraWebGrid" Assembly="Infragistics.WebUI.UltraWebGrid.v6.3, Version=6.3.20063.53, Culture=neutral, PublicKeyToken=7dd5c3163f2cd0cb" %)
(!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" )
(HTML)
(HEAD)
(title)testpage(/title)
(meta content="Microsoft Visual Studio .NET 7.1" name="GENERATOR")
(meta content="C#" name="CODE_LANGUAGE")
(meta content="JavaScript" name="vs_defaultClientScript")
(meta content="http://schemas.microsoft.com/intellisense/ie5" name="vs_targetSchema")
(LINK href="/ig_common/20063/Styles/Office2007Silver/ig_WebGrid.css " type="text/css"
rel="Stylesheet")
(/HEAD)
(body MS_POSITIONING="GridLayout" XMLNS:igtbl="http://schemas.infragistics.com/ASPNET/WebControls/UltraWebGrid")
(form id="Form1" method="post" runat="server")
(table border="1" )
(tr)
(td)
(igtbl:ultrawebgrid id="UltraWebGrid1"
runat="server" ImageDirectory="/ig_common/20063/Styles/Office2007Silver/WebGrid/")
(DisplayLayout CompactRendering="False" StationaryMarginsOutlookGroupBy="True" AllowSortingDefault="OnClient"
RowHeightDefault="20px" Version="4.00" ViewType="OutlookGroupBy" SelectTypeRowDefault="Extended"
BorderCollapseDefault="Separate" Name="UltraWebGrid1" CellClickActionDefault="RowSelect")
(AddNewBox)
(Style CssClass="igwgAddNewBoxSilver2k7")(/Style)
(ButtonStyle CssClass="igwgAddNewBtnSilver2k7")(/ButtonStyle)
(/AddNewBox)
(Pager)
(Style CssClass="igwgPgrSilver2k7")(/Style)
(/Pager)
(HeaderStyleDefault CssClass="igwgHdrSilver2k7")(/HeaderStyleDefault)
(FormulaErrorStyleDefault CssClass="igwgFormulaErrSilver2k7")(/FormulaErrorStyleDefault)
(GroupByRowStyleDefault CssClass="igwgGrpRowSilver2k7")(/GroupByRowStyleDefault)
(RowSelectorStyleDefault CssClass="igwgRowSlctrSilver2k7")(/RowSelectorStyleDefault)
(FrameStyle CssClass="igwgFrameSilver2k7")(/FrameStyle)
(FilterOptionsDefault DropDownRowCount="15")
(FilterHighlightRowStyle CssClass="igwgFltrRowHiLtSilver2k7")(/FilterHighlightRowStyle)
(FilterDropDownStyle CssClass="igwgFltrDrpDwnSilver2k7")(/FilterDropDownStyle)
(/FilterOptionsDefault)
(FooterStyleDefault CssClass="igwgFooterSilver2k7")(/FooterStyleDefault)
(ActivationObject BorderColor="181, 196, 223")
(BorderDetails WidthLeft="0px" WidthRight="0px")(/BorderDetails)
(/ActivationObject)
(GroupByBox)
(Style CssClass="igwgGrpBoxSilver2k7")(/Style)
(BandLabelStyle CssClass="igwgGrpBoxBandLblSilver2k7")(/BandLabelStyle)
(/GroupByBox)
(Images ImageDirectory="/ig_common/20063/Styles/Office2007Silver/WebGrid/" /)
(RowExpAreaStyleDefault CssClass="igwgRowExpSilver2k7")(/RowExpAreaStyleDefault)
(SelectedHeaderStyleDefault CssClass="igwgHdrSelSilver2k7")(/SelectedHeaderStyleDefault)
(FixedHeaderStyleDefault CssClass="igwgHdrFxdSilver2k7")(/FixedHeaderStyleDefault)
(EditCellStyleDefault CssClass="igwgCellEdtSilver2k7")(/EditCellStyleDefault)
(FixedFooterStyleDefault CssClass="igwgFtrFxdSilver2k7")(/FixedFooterStyleDefault)
(SelectedGroupByRowStyleDefault CssClass="igwgGrpRowSelSilver2k7")(/SelectedGroupByRowStyleDefault)
(SelectedRowStyleDefault CssClass="igwgRowSelSilver2k7")(/SelectedRowStyleDefault)
(RowAlternateStyleDefault CssClass="igwgRowAltSilver2k7")(/RowAlternateStyleDefault)
(RowStyleDefault CssClass="igwgRowSilver2k7")
(Padding Left="3px")(/Padding)
(/RowStyleDefault)
(FixedCellStyleDefault CssClass="igwgCellFxdSilver2k7")(/FixedCellStyleDefault)
(/DisplayLayout)
(Bands)
(igtbl:UltraGridBand)(/igtbl:UltraGridBand)
(/Bands)
(/igtbl:ultrawebgrid)
(/td)
(/tr)
(tr)
(td)(asp:button id="Button1" runat="server"
Text="Get value")(/asp:button)
(asp:button id="Button2" runat="server"
Text="Load")(/asp:button) (/td)
(/tr)
(/table)
(/form)
(/body)
(/HTML)
c# page
#region using
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using System.IO;
using System.Text;
using BMSQBInterface;
using bmsFramework.MyAccount;
using Infragistics.WebUI.UltraWebGrid;
#endregion
namespace bms
{
///
/// Summary description for testpage.
///
public class testpage : System.Web.UI.Page
{
protected BMSQBServer bmsQBServer = null;
protected DBConnection dbc;
protected Infragistics.WebUI.UltraWebGrid.UltraWebGrid UltraWebGrid1;
protected System.Web.UI.WebControls.Button Button1;
protected System.Web.UI.WebControls.Button Button2;
protected System.Data.SqlClient.SqlConnection myConn;
private void Page_Load(object sender, System.EventArgs e)
{
if(!Page.IsPostBack)
{
Button2_Click(sender, e); // simulates data load.
}
}
#region Web Form Designer generated code
override protected void OnInit(EventArgs e)
{
//
// CODEGEN: This call is required by the ASP.NET Web Form Designer.
//
InitializeComponent();
base.OnInit(e);
}
///
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
///
private void InitializeComponent()
{
this.UltraWebGrid1.InitializeRow += new Infragistics.WebUI.UltraWebGrid.InitializeRowEventHandler(this.UltraWebGrid1_InitializeRow);
this.UltraWebGrid1.InitializeLayout += new Infragistics.WebUI.UltraWebGrid.InitializeLayoutEventHandler(this.UltraWebGrid1_InitializeLayout);
this.Button1.Click += new System.EventHandler(this.Button1_Click);
this.Button2.Click += new System.EventHandler(this.Button2_Click);
this.Load += new System.EventHandler(this.Page_Load);
this.UltraWebGrid1.ClickCellButton += new ClickCellButtonEventHandler(UltraWebGrid1_ClickCellButton); //handles edit and delete button click events.
}
#endregion
private void UltraWebGrid1_InitializeLayout(object sender, Infragistics.WebUI.UltraWebGrid.LayoutEventArgs e)
{
UltraWebGrid1.DisplayLayout.AllowSortingDefault = Infragistics.WebUI.UltraWebGrid.AllowSorting.OnClient; // allow client sorting.
UltraWebGrid1.DisplayLayout.HeaderClickActionDefault = Infragistics.WebUI.UltraWebGrid.HeaderClickAction.SortSingle; // only sort single column.
UltraWebGrid1.DisplayLayout.SelectedRowStyleDefault.BackColor = Color.LightSteelBlue; // row selecter color.
//Name column for employee
UltraWebGrid1.Columns[1].Header.Style.HorizontalAlign = HorizontalAlign.Left;
UltraWebGrid1.Columns[1].Header.Caption = "Employee Name"; // default value from db column is name.
UltraWebGrid1.Columns[3].CellStyle.HorizontalAlign = HorizontalAlign.Center;
UltraWebGrid1.Columns[4].CellStyle.HorizontalAlign = HorizontalAlign.Center;
//Edit button.
UltraWebGrid1.Columns[7].Type= ColumnType.Button;
UltraWebGrid1.Columns[7].CellButtonDisplay=CellButtonDisplay.Always;
UltraWebGrid1.Columns[7].CellButtonStyle.Font.Name = "Verdana";
UltraWebGrid1.Columns[7].CellButtonStyle.Font.Size = FontUnit.Point(7);
UltraWebGrid1.Columns[7].CellButtonStyle.BackColor = Color.Lavender;
UltraWebGrid1.Columns[7].CellButtonStyle.Width = Unit.Pixel(50);
UltraWebGrid1.Columns[7].CellButtonStyle.Height = Unit.Pixel(20);
UltraWebGrid1.Columns[7].CellStyle.Padding.Left=new Unit("5px");
UltraWebGrid1.Columns[7].CellStyle.Padding.Right=new Unit("5px");
//Delete button.
UltraWebGrid1.Columns[8].Type= ColumnType.Button;
UltraWebGrid1.Columns[8].CellButtonDisplay=CellButtonDisplay.Always;
UltraWebGrid1.Columns[8].CellButtonStyle.Font.Name = "Verdana";
UltraWebGrid1.Columns[8].CellButtonStyle.Font.Size = FontUnit.Point(8);
UltraWebGrid1.Columns[8].CellButtonStyle.BackColor = Color.Lavender;
UltraWebGrid1.Columns[8].CellButtonStyle.Width = Unit.Pixel(70);
UltraWebGrid1.Columns[8].CellButtonStyle.Height = Unit.Pixel(20);
UltraWebGrid1.Columns[8].CellStyle.Padding.Left=new Unit("5px");
UltraWebGrid1.Columns[8].CellStyle.Padding.Right=new Unit("5px");
//Hide the key column..id.
UltraWebGrid1.Columns[0].Hidden = true;
UltraWebGrid1.Width = Unit.Empty;
UltraWebGrid1.Height = Unit.Empty;
UltraWebGrid1.DisplayLayout.FrameStyle.CustomRules = "table-layout:auto";
}
//To make a column values as link.
private void UltraWebGrid1_InitializeRow(object sender, Infragistics.WebUI.UltraWebGrid.RowEventArgs e)
{
e.Row.Cells[1].TargetURL = "http://www.google.com/search?hl=en&q=" + e.Row.Cells[0].Value.ToString();
}
//Handles button clicks inside the grid.
private void UltraWebGrid1_ClickCellButton(object sender, Infragistics.WebUI.UltraWebGrid.CellEventArgs e)
{
string strDBKey = UltraWebGrid1.DisplayLayout.ActiveRow.Cells[0].Text.ToString();
bool bdelete = UltraWebGrid1.DisplayLayout.ActiveRow.Cells[8].Activated; // is true when del button is clicked.
bool bedit = UltraWebGrid1.DisplayLayout.ActiveRow.Cells[7].Activated; // is true when edit button is clicked.
Session.Contents["ContactID"] = Int32.Parse(strDBKey);
if(bedit)
{
Response.Redirect("edit_account/Contact.aspx", true);
}
}
//Get row values when an external button click happens
private void Button1_Click(object sender, System.EventArgs e)
{
string strDBKey = UltraWebGrid1.DisplayLayout.ActiveRow.Cells[0].Text.ToString();
Response.Write("key is " + strDBKey.ToString());
}
private void Button2_Click(object sender, System.EventArgs e)
{
dbc = new DBConnection();
string strConnInfo = Application.Contents["ConnectionInfo"].ToString();
myConn = dbc.OpenDatabase(strConnInfo);
GridDBInterface ogd = new GridDBInterface();
//ogd.FillContactGrid(UltraWebGrid1,myConn,400,1,0);
DataSet ds1 = new DataSet();
ds1 = ogd.GetFormFilingHistory(myConn,400,1,0);
//Add edit and delete button to Dataset.
DataColumn hide=new DataColumn("Edits");
hide.DefaultValue = "Edit";
ds1.Tables[0].Columns.Add(hide);
DataColumn del=new DataColumn("Deletes");
del.DefaultValue = "Delete";
ds1.Tables[0].Columns.Add(del);
UltraWebGrid1.DataSource = ds1.Tables[0].DefaultView;
UltraWebGrid1.DataBind();
}
}
}
ds method:
public DataSet GetFormFilingHistory(System.Data.SqlClient.SqlConnection argConn,int CustomerID,short InternalContact,short Inactive)
{
string strQuery = "usp_xyz";
DataSet ds = new DataSet();
SqlDataAdapter da = new SqlDataAdapter(strQuery,argConn);
da.SelectCommand.CommandType = System.Data.CommandType.StoredProcedure;
da.SelectCommand.CommandTimeout = 0;
AddIDParam(da.SelectCommand, "@Customer_ID",CustomerID);
AddIDIntParam(da.SelectCommand, "@InternalContact",InternalContact);
AddIDIntParam(da.SelectCommand, "@Inactive",Inactive);
da.Fill(ds, "Contacts");
return ds;
}
- Inbuilt filter
- link column
- client side sorting
- edit and delete buttons in rows
- responding to events
- customizing grid while it load.
(%@ Register TagPrefix="igtbl" Namespace="Infragistics.WebUI.UltraWebGrid" Assembly="Infragistics.WebUI.UltraWebGrid.v6.3, Version=6.3.20063.53, Culture=neutral, PublicKeyToken=7dd5c3163f2cd0cb" %)
(!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" )
(HTML)
(HEAD)
(title)testpage(/title)
(meta content="Microsoft Visual Studio .NET 7.1" name="GENERATOR")
(meta content="C#" name="CODE_LANGUAGE")
(meta content="JavaScript" name="vs_defaultClientScript")
(meta content="http://schemas.microsoft.com/intellisense/ie5" name="vs_targetSchema")
(LINK href="/ig_common/20063/Styles/Office2007Silver/ig_WebGrid.css " type="text/css"
rel="Stylesheet")
(/HEAD)
(body MS_POSITIONING="GridLayout" XMLNS:igtbl="http://schemas.infragistics.com/ASPNET/WebControls/UltraWebGrid")
(form id="Form1" method="post" runat="server")
(table border="1" )
(tr)
(td)
(igtbl:ultrawebgrid id="UltraWebGrid1"
runat="server" ImageDirectory="/ig_common/20063/Styles/Office2007Silver/WebGrid/")
(DisplayLayout CompactRendering="False" StationaryMarginsOutlookGroupBy="True" AllowSortingDefault="OnClient"
RowHeightDefault="20px" Version="4.00" ViewType="OutlookGroupBy" SelectTypeRowDefault="Extended"
BorderCollapseDefault="Separate" Name="UltraWebGrid1" CellClickActionDefault="RowSelect")
(AddNewBox)
(Style CssClass="igwgAddNewBoxSilver2k7")(/Style)
(ButtonStyle CssClass="igwgAddNewBtnSilver2k7")(/ButtonStyle)
(/AddNewBox)
(Pager)
(Style CssClass="igwgPgrSilver2k7")(/Style)
(/Pager)
(HeaderStyleDefault CssClass="igwgHdrSilver2k7")(/HeaderStyleDefault)
(FormulaErrorStyleDefault CssClass="igwgFormulaErrSilver2k7")(/FormulaErrorStyleDefault)
(GroupByRowStyleDefault CssClass="igwgGrpRowSilver2k7")(/GroupByRowStyleDefault)
(RowSelectorStyleDefault CssClass="igwgRowSlctrSilver2k7")(/RowSelectorStyleDefault)
(FrameStyle CssClass="igwgFrameSilver2k7")(/FrameStyle)
(FilterOptionsDefault DropDownRowCount="15")
(FilterHighlightRowStyle CssClass="igwgFltrRowHiLtSilver2k7")(/FilterHighlightRowStyle)
(FilterDropDownStyle CssClass="igwgFltrDrpDwnSilver2k7")(/FilterDropDownStyle)
(/FilterOptionsDefault)
(FooterStyleDefault CssClass="igwgFooterSilver2k7")(/FooterStyleDefault)
(ActivationObject BorderColor="181, 196, 223")
(BorderDetails WidthLeft="0px" WidthRight="0px")(/BorderDetails)
(/ActivationObject)
(GroupByBox)
(Style CssClass="igwgGrpBoxSilver2k7")(/Style)
(BandLabelStyle CssClass="igwgGrpBoxBandLblSilver2k7")(/BandLabelStyle)
(/GroupByBox)
(Images ImageDirectory="/ig_common/20063/Styles/Office2007Silver/WebGrid/" /)
(RowExpAreaStyleDefault CssClass="igwgRowExpSilver2k7")(/RowExpAreaStyleDefault)
(SelectedHeaderStyleDefault CssClass="igwgHdrSelSilver2k7")(/SelectedHeaderStyleDefault)
(FixedHeaderStyleDefault CssClass="igwgHdrFxdSilver2k7")(/FixedHeaderStyleDefault)
(EditCellStyleDefault CssClass="igwgCellEdtSilver2k7")(/EditCellStyleDefault)
(FixedFooterStyleDefault CssClass="igwgFtrFxdSilver2k7")(/FixedFooterStyleDefault)
(SelectedGroupByRowStyleDefault CssClass="igwgGrpRowSelSilver2k7")(/SelectedGroupByRowStyleDefault)
(SelectedRowStyleDefault CssClass="igwgRowSelSilver2k7")(/SelectedRowStyleDefault)
(RowAlternateStyleDefault CssClass="igwgRowAltSilver2k7")(/RowAlternateStyleDefault)
(RowStyleDefault CssClass="igwgRowSilver2k7")
(Padding Left="3px")(/Padding)
(/RowStyleDefault)
(FixedCellStyleDefault CssClass="igwgCellFxdSilver2k7")(/FixedCellStyleDefault)
(/DisplayLayout)
(Bands)
(igtbl:UltraGridBand)(/igtbl:UltraGridBand)
(/Bands)
(/igtbl:ultrawebgrid)
(/td)
(/tr)
(tr)
(td)(asp:button id="Button1" runat="server"
Text="Get value")(/asp:button)
(asp:button id="Button2" runat="server"
Text="Load")(/asp:button) (/td)
(/tr)
(/table)
(/form)
(/body)
(/HTML)
c# page
#region using
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using System.IO;
using System.Text;
using BMSQBInterface;
using bmsFramework.MyAccount;
using Infragistics.WebUI.UltraWebGrid;
#endregion
namespace bms
{
///
/// Summary description for testpage.
///
public class testpage : System.Web.UI.Page
{
protected BMSQBServer bmsQBServer = null;
protected DBConnection dbc;
protected Infragistics.WebUI.UltraWebGrid.UltraWebGrid UltraWebGrid1;
protected System.Web.UI.WebControls.Button Button1;
protected System.Web.UI.WebControls.Button Button2;
protected System.Data.SqlClient.SqlConnection myConn;
private void Page_Load(object sender, System.EventArgs e)
{
if(!Page.IsPostBack)
{
Button2_Click(sender, e); // simulates data load.
}
}
#region Web Form Designer generated code
override protected void OnInit(EventArgs e)
{
//
// CODEGEN: This call is required by the ASP.NET Web Form Designer.
//
InitializeComponent();
base.OnInit(e);
}
///
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
///
private void InitializeComponent()
{
this.UltraWebGrid1.InitializeRow += new Infragistics.WebUI.UltraWebGrid.InitializeRowEventHandler(this.UltraWebGrid1_InitializeRow);
this.UltraWebGrid1.InitializeLayout += new Infragistics.WebUI.UltraWebGrid.InitializeLayoutEventHandler(this.UltraWebGrid1_InitializeLayout);
this.Button1.Click += new System.EventHandler(this.Button1_Click);
this.Button2.Click += new System.EventHandler(this.Button2_Click);
this.Load += new System.EventHandler(this.Page_Load);
this.UltraWebGrid1.ClickCellButton += new ClickCellButtonEventHandler(UltraWebGrid1_ClickCellButton); //handles edit and delete button click events.
}
#endregion
private void UltraWebGrid1_InitializeLayout(object sender, Infragistics.WebUI.UltraWebGrid.LayoutEventArgs e)
{
UltraWebGrid1.DisplayLayout.AllowSortingDefault = Infragistics.WebUI.UltraWebGrid.AllowSorting.OnClient; // allow client sorting.
UltraWebGrid1.DisplayLayout.HeaderClickActionDefault = Infragistics.WebUI.UltraWebGrid.HeaderClickAction.SortSingle; // only sort single column.
UltraWebGrid1.DisplayLayout.SelectedRowStyleDefault.BackColor = Color.LightSteelBlue; // row selecter color.
//Name column for employee
UltraWebGrid1.Columns[1].Header.Style.HorizontalAlign = HorizontalAlign.Left;
UltraWebGrid1.Columns[1].Header.Caption = "Employee Name"; // default value from db column is name.
UltraWebGrid1.Columns[3].CellStyle.HorizontalAlign = HorizontalAlign.Center;
UltraWebGrid1.Columns[4].CellStyle.HorizontalAlign = HorizontalAlign.Center;
//Edit button.
UltraWebGrid1.Columns[7].Type= ColumnType.Button;
UltraWebGrid1.Columns[7].CellButtonDisplay=CellButtonDisplay.Always;
UltraWebGrid1.Columns[7].CellButtonStyle.Font.Name = "Verdana";
UltraWebGrid1.Columns[7].CellButtonStyle.Font.Size = FontUnit.Point(7);
UltraWebGrid1.Columns[7].CellButtonStyle.BackColor = Color.Lavender;
UltraWebGrid1.Columns[7].CellButtonStyle.Width = Unit.Pixel(50);
UltraWebGrid1.Columns[7].CellButtonStyle.Height = Unit.Pixel(20);
UltraWebGrid1.Columns[7].CellStyle.Padding.Left=new Unit("5px");
UltraWebGrid1.Columns[7].CellStyle.Padding.Right=new Unit("5px");
//Delete button.
UltraWebGrid1.Columns[8].Type= ColumnType.Button;
UltraWebGrid1.Columns[8].CellButtonDisplay=CellButtonDisplay.Always;
UltraWebGrid1.Columns[8].CellButtonStyle.Font.Name = "Verdana";
UltraWebGrid1.Columns[8].CellButtonStyle.Font.Size = FontUnit.Point(8);
UltraWebGrid1.Columns[8].CellButtonStyle.BackColor = Color.Lavender;
UltraWebGrid1.Columns[8].CellButtonStyle.Width = Unit.Pixel(70);
UltraWebGrid1.Columns[8].CellButtonStyle.Height = Unit.Pixel(20);
UltraWebGrid1.Columns[8].CellStyle.Padding.Left=new Unit("5px");
UltraWebGrid1.Columns[8].CellStyle.Padding.Right=new Unit("5px");
//Hide the key column..id.
UltraWebGrid1.Columns[0].Hidden = true;
UltraWebGrid1.Width = Unit.Empty;
UltraWebGrid1.Height = Unit.Empty;
UltraWebGrid1.DisplayLayout.FrameStyle.CustomRules = "table-layout:auto";
}
//To make a column values as link.
private void UltraWebGrid1_InitializeRow(object sender, Infragistics.WebUI.UltraWebGrid.RowEventArgs e)
{
e.Row.Cells[1].TargetURL = "http://www.google.com/search?hl=en&q=" + e.Row.Cells[0].Value.ToString();
}
//Handles button clicks inside the grid.
private void UltraWebGrid1_ClickCellButton(object sender, Infragistics.WebUI.UltraWebGrid.CellEventArgs e)
{
string strDBKey = UltraWebGrid1.DisplayLayout.ActiveRow.Cells[0].Text.ToString();
bool bdelete = UltraWebGrid1.DisplayLayout.ActiveRow.Cells[8].Activated; // is true when del button is clicked.
bool bedit = UltraWebGrid1.DisplayLayout.ActiveRow.Cells[7].Activated; // is true when edit button is clicked.
Session.Contents["ContactID"] = Int32.Parse(strDBKey);
if(bedit)
{
Response.Redirect("edit_account/Contact.aspx", true);
}
}
//Get row values when an external button click happens
private void Button1_Click(object sender, System.EventArgs e)
{
string strDBKey = UltraWebGrid1.DisplayLayout.ActiveRow.Cells[0].Text.ToString();
Response.Write("key is " + strDBKey.ToString());
}
private void Button2_Click(object sender, System.EventArgs e)
{
dbc = new DBConnection();
string strConnInfo = Application.Contents["ConnectionInfo"].ToString();
myConn = dbc.OpenDatabase(strConnInfo);
GridDBInterface ogd = new GridDBInterface();
//ogd.FillContactGrid(UltraWebGrid1,myConn,400,1,0);
DataSet ds1 = new DataSet();
ds1 = ogd.GetFormFilingHistory(myConn,400,1,0);
//Add edit and delete button to Dataset.
DataColumn hide=new DataColumn("Edits");
hide.DefaultValue = "Edit";
ds1.Tables[0].Columns.Add(hide);
DataColumn del=new DataColumn("Deletes");
del.DefaultValue = "Delete";
ds1.Tables[0].Columns.Add(del);
UltraWebGrid1.DataSource = ds1.Tables[0].DefaultView;
UltraWebGrid1.DataBind();
}
}
}
ds method:
public DataSet GetFormFilingHistory(System.Data.SqlClient.SqlConnection argConn,int CustomerID,short InternalContact,short Inactive)
{
string strQuery = "usp_xyz";
DataSet ds = new DataSet();
SqlDataAdapter da = new SqlDataAdapter(strQuery,argConn);
da.SelectCommand.CommandType = System.Data.CommandType.StoredProcedure;
da.SelectCommand.CommandTimeout = 0;
AddIDParam(da.SelectCommand, "@Customer_ID",CustomerID);
AddIDIntParam(da.SelectCommand, "@InternalContact",InternalContact);
AddIDIntParam(da.SelectCommand, "@Inactive",Inactive);
da.Fill(ds, "Contacts");
return ds;
}
Subscribe to:
Posts (Atom)