or
<
telerik:GridNumericColumn
DataField
=
"VALUE"
HeaderText
=
"Testing Decimal Value"
DecimalDigits
=
"6"
DataType
=
"System.Decimal"
UniqueName
=
"VALUE"
NumericType
=
"Number"
/>
(TextBox)e.Item.FindControl(
"txtComponente"
);
return null, and I do not understand why public
void
RadGrid1_ItemComand(Object sender , GridCommandEventArgs e)
{
switch
(e.CommandName)
{
case
"Insert"
:
try
{
TextBox txtComponente = (TextBox)e.Item.FindControl(
"txtComponente"
);
TextBox txtDescricaoComponente = (TextBox)e.Item.FindControl(
"txtDescricaoComponente"
);
Inserir(txtComponente.Text, txtDescricaoComponente.Text);
DisplayMessage(
false
,
"Sucess!"
);
Response.Redirect(
"ConsultaComponente.aspx"
);
}
catch
( Exception ex)
{
DisplayMessage(
true
, ex.Message);
}
break
;
case
"Update"
:
try
{
//First attempt
var ID = item.GetDataKeyValue(
"IdComponente"
).ToString();
TextBox txtComponente = (TextBox)e.Item.FindControl(
"txtComponente"
);
TextBox txtDescricaoComponente = (TextBox)e.Item.FindControl(
"txtDescricaoComponente"
);
Update(ID,txtComponente.Text, txtDescricaoComponente.Text);
//Second attempt
GridEditableItem item = e.Item
as
GridEditableItem;
var ID = item.GetDataKeyValue(
"IdComponente"
).ToString();
Componente obj = ComponenteController.Consulta(Convert.ToInt32(ID));
item.UpdateValues(obj);
Update(obj)
}
catch
(Exception ex)
{
DisplayMessage(
true
, ex.Message);
}
break
;
}
<?xml version="1.0" encoding="utf-8"?>
<!-- For more information on how to configure your ASP.NET application,
please visit http://go.microsoft.com/fwlink/?LinkId=169433
old connection string <add name="dbtestConnectionString"
connectionString="Data Source=MNEWEY1\SQLEXPRESS;Trusted_Connection=Yes;
Initial Catalog=dbtest;Integrated Security=True" providerName="System.Data.SqlClient"/>
server connection string <add name="dbtestConnectionString"
connectionString="Data Source=DEBDEV1\SQLEXPRESS;Trusted_Connection=Yes;Initial Catalo
g=dbtest;Integrated Security=True" providerName="System.Data.SqlClient"/> -->
<configuration>
<appSettings>
<add key="ChartImageHandler" value="storage=file;timeout=20;dir=c:\TempImageFiles\;" />
<add key="Telerik.Skin" value="Transparent" />
</appSettings>
<connectionStrings>
<add name="ApplicationServices" connectionString="data source=.\SQLEXPRESS;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|\aspnetdb.mdf;User Instance=true" providerName="System.Data.SqlClient" />
<add name="dbtestConnectionString" connectionString="Data Source=MNEWEY1\SQLEXPRESS;Trusted_Connection=Yes;Initial Catalog=dbComplaints;Integrated Security=True" providerName="System.Data.SqlClient" />
<!-- <add name="dbComplaintsEntities" connectionString="metadata=res://*/DAL.ComplaintsData.csdl|res://*/DAL.ComplaintsData.ssdl|res://*/DAL.ComplaintsData.msl;provider=System.Data.SqlClient;provider connection string="data source=MNEWEY1\SQLEXPRESS;initial catalog=dbComplaints;integrated security=True;multipleactiveresultsets=True;App=EntityFramework"" providerName="System.Data.EntityClient" /> -->
</connectionStrings>
<system.web>
<customErrors mode="Off" />
<httpHandlers>
<add path="ChartImg.axd" verb="GET,HEAD,POST" type="System.Web.UI.DataVisualization.Charting.ChartHttpHandler, System.Web.DataVisualization, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" validate="false" />
<add path="Telerik.Web.UI.WebResource.axd" type="Telerik.Web.UI.WebResource" verb="*" validate="false" />
<add path="Reserved.ReportViewerWebControl.axd" verb="*" type="Microsoft.Reporting.WebForms.HttpHandler, Microsoft.ReportViewer.WebForms, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" validate="false" />
<add path="ChartImage.axd" type="Telerik.Web.UI.ChartHttpHandler" verb="*" validate="false" />
<add path="Telerik.Web.UI.SpellCheckHandler.axd" type="Telerik.Web.UI.SpellCheckHandler" verb="*" validate="false" />
<add path="Telerik.Web.UI.DialogHandler.aspx" type="Telerik.Web.UI.DialogHandler" verb="*" validate="false" />
<add path="Telerik.RadUploadProgressHandler.ashx" type="Telerik.Web.UI.RadUploadProgressHandler" verb="*" validate="false" />
</httpHandlers>
<compilation debug="true" strict="false" explicit="true" targetFramework="4.0">
<assemblies>
<add assembly="System.Web.DataVisualization, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
<add assembly="System.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A" />
<add assembly="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089" />
<add assembly="System.Speech, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
<add assembly="Microsoft.ReportViewer.WebForms, Version=10.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A" />
<add assembly="Microsoft.ReportViewer.Common, Version=10.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A" />
<add assembly="Microsoft.Build.Framework, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A" />
<add assembly="System.Management, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A" />
</assemblies>
<buildProviders>
<add extension=".rdlc" type="Microsoft.Reporting.RdlBuildProvider, Microsoft.ReportViewer.WebForms, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
</buildProviders>
</compilation>
<authentication mode="Windows" />
<authorization>
<deny users="?" />
</authorization>
<identity impersonate="true" />
<membership>
<providers>
<clear />
<add name="AspNetSqlMembershipProvider" type="System.Web.Security.SqlMembershipProvider" connectionStringName="ApplicationServices" enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="false" requiresUniqueEmail="false" maxInvalidPasswordAttempts="5" minRequiredPasswordLength="6" minRequiredNonalphanumericCharacters="0" passwordAttemptWindow="10" applicationName="/" />
</providers>
</membership>
<profile>
<providers>
<clear />
<add name="AspNetSqlProfileProvider" type="System.Web.Profile.SqlProfileProvider" connectionStringName="ApplicationServices" applicationName="/" />
</providers>
</profile>
<roleManager enabled="false">
<providers>
<clear />
<add name="AspNetSqlRoleProvider" type="System.Web.Security.SqlRoleProvider" connectionStringName="ApplicationServices" applicationName="/" />
<add name="AspNetWindowsTokenRoleProvider" type="System.Web.Security.WindowsTokenRoleProvider" applicationName="/" />
</providers>
</roleManager>
<pages maintainScrollPositionOnPostBack="true">
<controls>
<add tagPrefix="ajaxToolkit" namespace="AjaxControlToolkit" assembly="AjaxControlToolkit" />
<add tagPrefix="asp" namespace="System.Web.UI.DataVisualization.Charting" assembly="System.Web.DataVisualization, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
<add tagPrefix="telerik" namespace="Telerik.Web.UI" assembly="Telerik.Web.UI" />
</controls>
</pages>
<httpModules />
</system.web>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true" />
<validation validateIntegratedModeConfiguration="false" />
<handlers>
<remove name="ChartImageHandler" />
<remove name="ChartImage_axd" />
<remove name="Telerik_Web_UI_SpellCheckHandler_axd" />
<remove name="Telerik_Web_UI_DialogHandler_aspx" />
<remove name="Telerik_RadUploadProgressHandler_ashx" />
<remove name="Telerik_Web_UI_WebResource_axd" />
<add name="ChartImageHandler" preCondition="integratedMode" verb="GET,HEAD,POST" path="ChartImg.axd" type="System.Web.UI.DataVisualization.Charting.ChartHttpHandler, System.Web.DataVisualization, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
<!-- <add name="Telerik.Web.UI.WebResource" path="Telerik.Web.UI.WebResource.axd" verb="*" type="Telerik.Web.UI.WebResource, Telerik.Web.UI, Version=2012.1.411.40, Culture=neutral, PublicKeyToken=121fae78165ba3d4" /> -->
<add name="ReportViewerWebControlHandler" preCondition="integratedMode" verb="*" path="Reserved.ReportViewerWebControl.axd" type="Microsoft.Reporting.WebForms.HttpHandler, Microsoft.ReportViewer.WebForms, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<add name="ChartImage_axd" path="ChartImage.axd" type="Telerik.Web.UI.ChartHttpHandler" verb="*" preCondition="integratedMode" />
<add name="Telerik_Web_UI_SpellCheckHandler_axd" path="Telerik.Web.UI.SpellCheckHandler.axd" type="Telerik.Web.UI.SpellCheckHandler" verb="*" preCondition="integratedMode" />
<add name="Telerik_Web_UI_DialogHandler_aspx" path="Telerik.Web.UI.DialogHandler.aspx" type="Telerik.Web.UI.DialogHandler" verb="*" preCondition="integratedMode" />
<add name="Telerik_RadUploadProgressHandler_ashx" path="Telerik.RadUploadProgressHandler.ashx" type="Telerik.Web.UI.RadUploadProgressHandler" verb="*" preCondition="integratedMode" />
<add name="Telerik_Web_UI_WebResource_axd" path="Telerik.Web.UI.WebResource.axd" type="Telerik.Web.UI.WebResource" verb="*" preCondition="integratedMode" />
</handlers>
</system.webServer>
</configuration>
private
readonly
GridTableView detailTable;
private
readonly
RadGrid grid =
new
RadGrid();
private
void
InitialiseGrid()
{
this
.Page.ClientScript.RegisterStartupScript(
this
.GetType(),
"SearchGrid"
, Resources.SearchGrid,
true
);
grid.ID =
"grid"
;
grid.PagerStyle.AlwaysVisible =
true
;
this
.grid.ClientSettings.ClientEvents.OnRowDblClick =
"SearchGridRowDoubleClick"
;
this
.grid.MasterTableView.Name =
"Jobs"
;
this
.grid.MasterTableView.DataKeyNames =
new
[] {
"BatchId"
};
this
.grid.MasterTableView.ClientDataKeyNames =
new
[] {
"Id"
};
this
.grid.MasterTableView.HierarchyLoadMode = GridChildLoadMode.ServerOnDemand;
this
.grid.NeedDataSource += GridNeedDataSource;
this
.grid.DetailTableDataBind += GridDetailTableDataBind;
this
.grid.Columns.Add(
new
GridImageColumn { ImageUrl =
"Images/Tasks.ico"
});
var securityImage = userHasSecurityLevel ?
"Images/Edit1.png"
:
"Images/Delete.png"
this
.grid.Columns.Add(
new
GridBoundColumn { DataField =
"Surname"
, HeaderText = Resources.SurnameColumnText });
this
.grid.Columns.Add(
new
GridBoundColumn { DataField =
"Forename"
, HeaderText = Resources.FornameColumnText });
this
.grid.Columns.Add(
new
GridImageColumn {
DataImageUrlFields =
"SecurityImage"
});