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();
}
}
}
}
No comments:
Post a Comment