Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
65
How to create a Template Column (Text box) in UltraWebGrid
posted

Hi,

I have created UltraWebGrid and design some cloumns at design time. One column is a template column which should come as text box. All the columns are bound columns. I am assigning DataSource to the grid at run time i.e. in the "Page_Load" event and then binding it.

My problem is template column is visible as text box in the design time but at run time it does not come as text box.

I am using below code. I am also attaching code as zip files.

Please check the code and let me know where I am wrong.

Thanks.

Prateek

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="InfragisticsGrid_AutoComplete.aspx.cs" Inherits="AJAX_Popup_Control.InfragisticsGrid_AutoComplete" %>

<%@ Register assembly="Infragistics35.WebUI.UltraWebGrid.v10.2, Version=10.2.20102.1011, Culture=neutral, PublicKeyToken=7dd5c3163f2cd0cb" namespace="Infragistics.WebUI.UltraWebGrid" tagprefix="igtbl" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >

<head runat="server">

<title>Infragistics Grid AutoComplete</title>

</head>

<body>

<form id="form1" runat="server">

<div>

</div>

<igtbl:UltraWebGrid ID="UltraWebGrid1" runat="server" Height="200px"

Width="1408px" ondatabound="UltraWebGrid1_DataBound">

<bands>

<igtbl:UltraGridBand>

<Columns>

<igtbl:UltraGridColumn Key="MAIN_ID" IsBound="true" BaseColumnName="ID">

<Header Caption="ID" Title="ID">

</Header>

</igtbl:UltraGridColumn>

<igtbl:UltraGridColumn Key="FULLNAME" IsBound="true">

<Header Caption="Name">

<RowLayoutColumnInfo OriginX="1" />

</Header>

<Footer>

<RowLayoutColumnInfo OriginX="1" />

</Footer>

</igtbl:UltraGridColumn>

<igtbl:UltraGridColumn Key="FULLADDRESS" IsBound="true" Width="500px" ValueList-Style-Width="500px">

<ValueList>

<Style Width="500px"></Style>

</ValueList>

<Header Caption="Address">

<RowLayoutColumnInfo OriginX="2" />

</Header>

<Footer>

<RowLayoutColumnInfo OriginX="2" />

</Footer>

</igtbl:UltraGridColumn>

<igtbl:UltraGridColumn Key="AGE" IsBound="true">

<Header Caption="Age">

<RowLayoutColumnInfo OriginX="3" />

</Header>

<Footer>

<RowLayoutColumnInfo OriginX="3" />

</Footer>

</igtbl:UltraGridColumn>

<igtbl:UltraGridColumn Key="MOBILENUMBER" IsBound="true">

<Header Caption="Phone Number">

<RowLayoutColumnInfo OriginX="4" />

</Header>

<Footer>

<RowLayoutColumnInfo OriginX="4" />

</Footer>

</igtbl:UltraGridColumn>

<igtbl:TemplatedColumn BaseColumnName="Comment" Key="Comment" IsBound="true" Width="500px"

AllowUpdate="Yes" Type="Custom" >

<Header Caption="Comment">

<RowLayoutColumnInfo OriginX="5" />

</Header>

<CellTemplate>

<asp:TextBox id="txtComment" value="<%# Container.Text %>" runat="server" Width="500px">

</asp:TextBox>

</CellTemplate>

<Footer>

<RowLayoutColumnInfo OriginX="5"></RowLayoutColumnInfo>

</Footer>

</igtbl:TemplatedColumn>

</Columns>

<addnewrow view="NotSet" visible="NotSet">

</addnewrow>

</igtbl:UltraGridBand>

</bands>

<displaylayout name="UltraWebGrid1" bordercollapsedefault="Separate" allowcolsizingdefault="Free"

rowheightdefault="25px" rowselectorsdefault="No" tablelayout="Auto" version="4.00"

ColWidthDefault="150px" CellClickActionDefault="CellSelect"

viewtype="OutlookGroupBy">

<framestyle backcolor="Window" bordercolor="InactiveCaption"

borderstyle="Solid" borderwidth="1px" font-names="Microsoft Sans Serif"

font-size="8.25pt" height="200px" width="1408px">

</framestyle>

<pager minimumpagesfordisplay="2">

<PagerStyle BackColor="LightGray" BorderStyle="Solid" BorderWidth="1px">

<borderdetails colorleft="White" colortop="White" widthleft="1px"

widthtop="1px" />

</PagerStyle>

</pager>

<editcellstyledefault borderstyle="None" borderwidth="0px">

</editcellstyledefault>

<footerstyledefault backcolor="LightGray" borderstyle="Solid" borderwidth="1px">

<borderdetails colorleft="White" colortop="White" widthleft="1px"

widthtop="1px" />

</footerstyledefault>

<headerstyledefault backcolor="LightGray" borderstyle="Solid"

horizontalalign="Left">

<borderdetails colorleft="White" colortop="White" widthleft="1px"

widthtop="1px" />

</headerstyledefault>

<rowstyledefault backcolor="Window" bordercolor="Silver" borderstyle="Solid"

borderwidth="1px" font-names="Microsoft Sans Serif" font-size="8.25pt">

<padding left="3px" />

<borderdetails colorleft="Window" colortop="Window" />

</rowstyledefault>

<groupbyrowstyledefault backcolor="Control" bordercolor="Window">

</groupbyrowstyledefault>

<groupbybox>

<boxstyle backcolor="ActiveBorder" bordercolor="Window">

</boxstyle>

</groupbybox>

<addnewbox hidden="False">

<boxstyle backcolor="Window" bordercolor="InactiveCaption" borderstyle="Solid"

borderwidth="1px">

<borderdetails colorleft="White" colortop="White" widthleft="1px"

widthtop="1px" />

</boxstyle>

</addnewbox>

<activationobject bordercolor="" borderwidth="">

</activationobject>

<filteroptionsdefault>

<filterdropdownstyle backcolor="White" bordercolor="Silver" borderstyle="Solid"

borderwidth="1px" customrules="overflow:auto;"

font-names="Verdana,Arial,Helvetica,sans-serif" font-size="11px" height="300px"

width="200px">

<padding left="2px" />

</filterdropdownstyle>

<filterhighlightrowstyle backcolor="#151C55" forecolor="White">

</filterhighlightrowstyle>

<filteroperanddropdownstyle backcolor="White" bordercolor="Silver"

borderstyle="Solid" borderwidth="1px" customrules="overflow:auto;"

font-names="Verdana,Arial,Helvetica,sans-serif" font-size="11px">

<padding left="2px" />

</filteroperanddropdownstyle>

</filteroptionsdefault>

</displaylayout>

</igtbl:UltraWebGrid>

<asp:Label ID="lblError" runat="server" Text="" Visible="false"></asp:Label>

</form>

</body>

</html>

 

Code Behind Code:

 

protected void Page_Load(object sender, EventArgs e)

{

try

{

string sqlQuery = "Select * from COMMENT_MAIN";

DBUtilities objDBUtil = new DBUtilities();

using (DataSet dsCommentData = objDBUtil.GetDataSetSQLQuery(sqlQuery))

{

UltraWebGrid1.DataSource = dsCommentData.Tables[0];

UltraWebGrid1.DataBind();

}

}

catch (Exception ex)

{

lblError.Visible = true;

lblError.Text = ex.ToString();

}

}

Parents
No Data
Reply Children
No Data