Hello,
I have one telerik radgrid with EditFormSttings and i have two fields (ID="editCodEmp" e ID="editNIFFilho") where (Enabled="false"). In code behind i need make (enable="true"), how?
My Code Behind:
protected void Insert_Click(object source, EventArgs e)//Telerik.Web.UI.GridItemEventArgs
{
try
{
error.Style["Display"] = "none";
success.Style["Display"] = "none";
how to access "editCodEmp"?
how to access "editNIFFilho"?
CTGrid.MasterTableView.IsItemInserted = true;
CTGrid.MasterTableView.Rebind();
}
}
catch (Exception ex)
{
Logger.FillLog(ex, Session["Username"].ToString(), Session["Produto"].ToString(), "Insert_Click");
error.Style["Display"] = "block";
errorMessage.Text = ConfigurationManager.AppSettings["genericError"].ToString();
}
}
My Code ASPX:
<telerik:RadGrid ID="CTGrid" AllowSorting="true" AutoGenerateColumns="false" PageSize="10"
AllowPaging="true" AllowMultiRowSelection="true" runat="server" GridLines="None"
Width="100%" Skin="TicketBlue" EnableEmbeddedSkins="false" OnItemDataBound="CTGrid_ItemDataBound"
OnUpdateCommand="CTGrid_UpdateCommand" OnInsertCommand="CTGrid_InsertCommand"
OnDeleteCommand="CTGrid_DeleteCommand" OnItemCreated="CTGrid_ItemCreated">
<MasterTableView Width="100%" Summary="RadGrid table" EditMode="EditForms" HierarchyLoadMode="Client"
ExpandCollapseColumn-Display="false" InsertItemDisplay="Top" DataKeyNames="id,NIFFilho, DescricaoEstado, DataRegisto">
<DetailTables>
..........
<EditFormSettings EditFormType="Template">
<FormTemplate>
<table align="left" width="100%" class="editTemplate">
<tr>
<td>
Nº Contribuinte *
</td>
<td>
<asp:TextBox ID="editCodEmp" Width="70px" CssClass="editFields" MaxLength="9" Enabled="false" runat="server" Text='<%# Bind("CodEmp") %>'></asp:TextBox>
</td>
<td>
Nome do Funcionário *
</td>
<td>
<asp:TextBox ID="editNomeFuncionario" Width="250px" CssClass="editFields" MaxLength="40" runat="server"
Text='<%# Bind("NomeFuncionario") %>'></asp:TextBox>
</td>
<td>
Nome a gravar no Cartão *
</td>
<td>
<asp:TextBox ID="editNomeGravar" Width="160px" CssClass="editFields" MaxLength="21" runat="server" Text='<%# Bind("NomeGravar") %>'></asp:TextBox>
</td>
</tr>
<asp:PlaceHolder ID="PlaceHolder1" runat="server" OnLoad="MakeVisibleOrNot">
<tr id = "CartaoFilhos" runat = "server">
<td>
Nº Contr. Filho *
</td>
<td>
<asp:TextBox ID="editNIFFilho" Width="70px" Enabled="False" CssClass="editFields" MaxLength="9" runat="server"
Text='<%# Bind("NIFFilho") %>'></asp:TextBox>
</td>
...........
<tr>
<td colspan="8">
<br />
* Campos obrigatórios
</td>
</tr>
<tr>
<td align="left" colspan="6">
<asp:Button ID="btnUpdate" Text='<%# (Container is GridEditFormInsertItem) ? "Gravar" : "Gravar" %>'
runat="server" CommandName='<%# (Container is GridEditFormInsertItem) ? "PerformInsert" : "Update" %>'>
</asp:Button>
<asp:Button ID="btnCancel" Text="Cancelar" runat="server" CausesValidation="False"
CommandName="Cancel"></asp:Button>
</td>
</tr>
<asp:HiddenField ID="id" runat="server" Value='<%# Bind( "id") %>' />
</table>
</FormTemplate>
</EditFormSettings>
</MasterTableView>