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" />
<Footer>
</Footer>
<igtbl:UltraGridColumn Key="FULLADDRESS" IsBound="true" Width="500px" ValueList-Style-Width="500px">
<ValueList>
<Style Width="500px"></Style>
</ValueList>
<Header Caption="Address">
<RowLayoutColumnInfo OriginX="2" />
<igtbl:UltraGridColumn Key="AGE" IsBound="true">
<Header Caption="Age">
<RowLayoutColumnInfo OriginX="3" />
<igtbl:UltraGridColumn Key="MOBILENUMBER" IsBound="true">
<Header Caption="Phone Number">
<RowLayoutColumnInfo OriginX="4" />
<igtbl:TemplatedColumn BaseColumnName="Comment" Key="Comment" IsBound="true" Width="500px"
AllowUpdate="Yes" Type="Custom" >
<Header Caption="Comment">
<RowLayoutColumnInfo OriginX="5" />
<CellTemplate>
<asp:TextBox id="txtComment" value="<%# Container.Text %>" runat="server" Width="500px">
</asp:TextBox>
</CellTemplate>
<RowLayoutColumnInfo OriginX="5"></RowLayoutColumnInfo>
</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">
</footerstyledefault>
<headerstyledefault backcolor="LightGray" borderstyle="Solid"
horizontalalign="Left">
</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">
</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">
</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();
Hello Prateek,
It has been a while since you have made your post, but I suppose the other community members can benefit from this answer as well.
If you want to create a Template Column for the “UltraWebGrid” control that will contain “TextBox” or any other ASP/HTML control you should read the following article that explains how to add such type of column in the grid:
http://help.infragistics.com/Help/NetAdvantage/ASPNET/2011.1/CLR4.0/html/WebGrid_Using_Column_Templates.html
http://help.infragistics.com/Help/NetAdvantage/ASPNET/2011.1/CLR4.0/html/WebGrid_Using_the_DataBinder_Evaluation_Syntax_in_Templated_Columns.html
I hope that this information will resolve the described issue.