I trying to edit row or delete it an this just doesn't work,and don't throw any ex
Do any know what i am missing here?
My server side is empty i didn't put any functions there.
I think if don't get any errors maybe,i have problem in sql security that don't allow me to do update
<%# Page Language="C#" AutoEventWireup="true" CodeBehind="RadGroupedGridForm.aspx.cs" Inherits="RadGroupedGridForm" %>
<telerik:RadStyleSheetManager ID="RadStyleSheetManager1" runat="server" />
</head>
<body>
<form id="form1" runat="server">
<telerik:RadScriptManager ID="RadScriptManager1" runat="server">
</telerik:RadScriptManager>
<telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
<AjaxSettings>
<telerik:AjaxSetting AjaxControlID="RadGrid1">
<UpdatedControls>
<telerik:AjaxUpdatedControl ControlID="RadGrid1" />
</UpdatedControls>
</telerik:AjaxSetting>
</AjaxSettings>
</telerik:RadAjaxManager>
<div>
<asp:SqlDataSource ConnectionString="<%$ ConnectionStrings:WebsiteConnectionString %>" ID="DataSource1" runat="server" DeleteCommand="DELETE FROM [TABLE_PRODUCT_CATEGORY] WHERE [ID] = #ID" InsertCommand="INSERT INTO [TABLE_PRODUCT_CATEGORY] ([ID], [LoadCategory], [ProductCategory], [ShortDescription], [NumberOfItems]) VALUES (#ID, #LoadCategory, #ProductCategory, #ShortDescription, #NumberOfItems)" SelectCommand="SELECT [ID], [LoadCategory], [ProductCategory], [ShortDescription], [NumberOfItems] FROM [TABLE_PRODUCT_CATEGORY]" UpdateCommand="UPDATE [TABLE_PRODUCT_CATEGORY] SET [LoadCategory] = #LoadCategory, [ProductCategory] = #ProductCategory, [ShortDescription] = #ShortDescription, [NumberOfItems] = #NumberOfItems WHERE [ID] = #ID">
<DeleteParameters>
<asp:Parameter Name="ID" Type="Int32" />
</DeleteParameters>
<UpdateParameters>
<asp:Parameter Name="LoadCategory" Type="Boolean" />
<asp:Parameter Name="ProductCategory" Type="String" />
<asp:Parameter Name="ShortDescription" Type="String" />
<asp:Parameter Name="NumberOfItems" Type="Int16" />
<asp:Parameter Name="ID" Type="Int32" />
</UpdateParameters>
</asp:SqlDataSource>
<telerik:RadGrid ID="RadGrid1" runat="server" ShowGroupPanel="True" GridLines="None" DataSourceID="DataSource1" AllowFiltering="False" AllowFilteringByColumn="True" AutoGenerateDeleteColumn="True" AutoGenerateEditColumn="True" CellSpacing="0">
<MasterTableView GroupLoadMode="server" ShowGroupFooter="False" GroupsDefaultExpanded="False" AutoGenerateColumns="False" DataKeyNames="ID">
<Columns>
<telerik:GridBoundColumn DataField="ID" DataType="System.Int32" FilterControlAltText="Filter ID column" HeaderText="ID" ReadOnly="True" SortExpression="ID" UniqueName="ID">
</telerik:GridBoundColumn>
<telerik:GridCheckBoxColumn DataField="LoadCategory" DataType="System.Boolean" FilterControlAltText="Filter LoadCategory column" HeaderText="LoadCategory" SortExpression="LoadCategory" UniqueName="LoadCategory">
</telerik:GridCheckBoxColumn>
<telerik:GridBoundColumn DataField="ProductCategory" FilterControlAltText="Filter ProductCategory column" HeaderText="ProductCategory" SortExpression="ProductCategory" UniqueName="ProductCategory">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="ShortDescription" FilterControlAltText="Filter ShortDescription column" HeaderText="ShortDescription" SortExpression="ShortDescription" UniqueName="ShortDescription">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="NumberOfItems" DataType="System.Int16" FilterControlAltText="Filter NumberOfItems column" HeaderText="NumberOfItems" SortExpression="NumberOfItems" UniqueName="NumberOfItems">
</telerik:GridBoundColumn>
</Columns>
</MasterTableView>
<ClientSettings AllowDragToGroup="True">
</ClientSettings>
</telerik:RadGrid>
</div>
</form>
</body>
</html>
Please add below property in your radgrid and check.
<telerik:RadGrid AllowAutomaticDeletes="true"
AllowAutomaticUpdates="true" AllowAutomaticInserts="true">
Related
I am trying to add values from my textboxes and combos as "history" to by GridPanel. The script looks ok, and my website should return my filled grid, but it doesn't happen.
<script>
var addRecord = function (form, grid) {
if (!form.getForm().isValid()) {
Ext.net.Notification.show({
iconCls: "icon-exclamation",
html: "Form is invalid",
title: "Error"
});
return false;
}
grid.store.insert(0, new MyModel(form.getForm().getFieldValues()));
form.getForm().reset();
};
</script>
<ext:Store
ID="Store1"
runat="server"
AutoSync="true"
ShowWarningOnFailure="false">
<Model>
<ext:Model ID="Model1" runat="server" IDProperty="Id" Name="MyModel">
<Fields>
<ext:ModelField Name="Id" Type="Int" />
<ext:ModelField Name="A" />
<ext:ModelField Name="Operator1" />
<ext:ModelField Name="B" />
<ext:ModelField Name="Operator2" />
<ext:ModelField Name="C" />
<ext:ModelField Name="Wynik" />
<ext:ModelField Name="Data" />
</Fields>
</ext:Model>
</Model>
</ext:Store>
<form id="form1" runat="server">
<div>
<ext:ResourceManager ID="ResourceManager1" runat="server">
</ext:ResourceManager>
<ext:Panel ID="UserForm" runat="server" Layout="HBoxLayout" Title="Kalkulator">
<Items>
<ext:Panel ID="Panel6" Layout="VBoxLayout" runat="server">
<Items>
<ext:Label ID="Label4" Margin="10" Text="A" runat="server">
</ext:Label>
<ext:TextField Name="A" Margin="10" MaskRe="[1-9]" ID="txtA" runat="server">
</ext:TextField>
</Items>
</ext:Panel>
<ext:Panel ID="Panel7" Layout="VBoxLayout" runat="server">
<Items>
<ext:Label ID="Label1" Margin="10" Text="Operator" runat="server">
</ext:Label>
<ext:ComboBox Name="Operator1" Margin="10" ID="cbox1" runat="server"></ext:ComboBox>
</Items>
</ext:Panel>
<ext:Panel ID="Panel8" runat="server" Layout="VBoxLayout">
<Items>
<ext:Label ID="Label5" Margin="10" Text="B" runat="server">
</ext:Label>
<ext:TextField Name="B" Margin="10" MaskRe="[1-9]" ID="txtB" runat="server">
</ext:TextField>
</Items>
</ext:Panel>
<ext:Panel ID="Panel9" runat="server" Layout="VBoxLayout">
<Items>
<ext:Label ID="Label2" Margin="10" Text="Operator" runat="server">
</ext:Label>
<ext:ComboBox Name="Operator2" Margin="10" ID="cbox2" runat="server"></ext:ComboBox>
</Items>
</ext:Panel>
<ext:Panel ID="Panel10" runat="server" Layout="VBoxLayout">
<Items>
<ext:Label ID="Label6" Margin="10" Text="C" runat="server">
</ext:Label>
<ext:TextField Name="C" Margin="10" MaskRe="[1-9]" ID="txtC" runat="server">
</ext:TextField>
</Items>
</ext:Panel>
<ext:Panel ID="Panel11" runat="server" Layout="VBoxLayout">
<Items>
<ext:Button ID="btnhelp" Margin="6" OnDirectClick="helpclick" runat="server" Width="70" Text="=?">
</ext:Button>
<ext:Button ID="btneq" Margin="6" OnDirectClick="equalclick" runat="server" Width="70" Text="Oblicz">
<Listeners>
<Click Handler="addRecord(#{UserForm}, #{GridPanel1});" />
</Listeners>
</ext:Button>
</Items>
</ext:Panel>
<ext:Panel ID="Panel12" runat="server" Layout="VBoxLayout">
<Items>
<ext:Label ID="Label3" Margin="14" Text="Wynik" runat="server">
</ext:Label>
<ext:Label Name="Wynik" Margin="14" ID="lblsc" Text="Wynik" runat="server">
</ext:Label>
</Items>
</ext:Panel>
</Items>
</ext:Panel>
<br />
<ext:GridPanel
ID="GridPanel1"
runat="server"
Title="Historia"
Width="1100"
Height="350">
<ColumnModel>
<Columns>
<ext:Column ID="Column1" runat="server" Text="Lp" DataIndex="Lp" />
<ext:Column ID="Column2" runat="server" Text="A" DataIndex="A" />
<ext:Column ID="Column3" runat="server" Text="Operator" DataIndex="Operator1" />
<ext:Column ID="Column4" runat="server" Text="B" DataIndex="B" />
<ext:Column ID="Column5" runat="server" Text="Operator" DataIndex="Operator2" />
<ext:Column ID="Column6" runat="server" Text="C" DataIndex="C" />
<ext:Column ID="Column7" runat="server" Text="Wynik" DataIndex="Wynik" />
<ext:Column ID="Column8" runat="server" Text="Data" DataIndex="Data" />
</Columns>
</ColumnModel>
</ext:GridPanel>
When I click on button it doesn't work. What is an issue?
I have an aspx page, however I am experiencing a strange problem.
I have a RadGrid datagrid in my webpage, I'm binding the data on the client side using JavaScript. I have created a GridTemplateColumn in the RadGrid, see below code:
<td colspan="2">
<telerik:RadGrid ID="OrderLines" GridLines="None" AutoGenerateColumns="false" PageSize="1" AllowMultiRowEdit="True" MasterTableView-EditMode="EditForms" AllowPaging="false" AllowSorting="false" runat="server">
<ClientSettings>
<Scrolling AllowScroll="true" UseStaticHeaders="true" />
<ClientEvents OnCommand="onCommand" />
</ClientSettings>
<MasterTableView ShowFooter="true" ClientDataKeyNames="ItemID" TableLayout="Auto" EditMode="InPlace">
<Columns>
<telerik:GridBoundColumn DataField="ItemCode" HeaderText="Item" UniqueName="Item"
HeaderStyle-Width="400px" ItemStyle-Width="400px" ItemStyle-HorizontalAlign="Left"
ReadOnly="true">
</telerik:GridBoundColumn>
<telerik:GridTemplateColumn HeaderText="Test" HeaderStyle-HorizontalAlign="Left"
UniqueName="Test" HeaderStyle-Width="120px" ItemStyle-Width="120px" ItemStyle-HorizontalAlign="Left">
<ItemTemplate>
<telerik:RadNumericTextBox runat="server" ID="Qty" Width="40px"/>
</ItemTemplate>
</telerik:GridTemplateColumn>
<telerik:GridBoundColumn DataField="UnitPrice" HeaderText="Unit Price" HeaderStyle-HorizontalAlign="Left"
UniqueName="UnitPrice" HeaderStyle-Width="100px" ItemStyle-Width="100px" ItemStyle-HorizontalAlign="Left"
DataFormatString="{0:N}" ReadOnly="true">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="LineTotalExVat" HeaderText="Total (Excl VAT)"
HeaderStyle-HorizontalAlign="Left" UniqueName="LineTotalExVat" HeaderStyle-Width="100px"
ItemStyle-Width="100px" ItemStyle-HorizontalAlign="Left" DataFormatString="{0:N}"
ReadOnly="true">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="VAT" HeaderText="VAT" HeaderStyle-Width="100px"
HeaderStyle-HorizontalAlign="Left" ItemStyle-Width="100px" ItemStyle-HorizontalAlign="Left"
DataFormatString="{0:N}" ReadOnly="true">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="LineTotal" HeaderText="Line Total" HeaderStyle-Width="100px"
HeaderStyle-HorizontalAlign="Left" ItemStyle-Width="100px" ItemStyle-HorizontalAlign="Left"
DataFormatString="{0:N}" ReadOnly="true">
</telerik:GridBoundColumn>
<telerik:GridButtonColumn HeaderText="Delete" CommandName="Delete" Text="Delete"
ItemStyle-Width="50px" HeaderStyle-Width="50px">
</telerik:GridButtonColumn>
</Columns>
</MasterTableView>
</telerik:RadGrid>
</td>
</tr>
The problem is when I launch the website I get the following: see below image:
The custom column doesn't appear on all the rows.
Any help would be greatly appreciated.
Hi I managed to sort this out by changing the PageSize="1" to read PageSize="1000" so the first 1000 records on my RadGrid will display my custom ColumnTemplate.
I have this WebForm
<%# Page Language="C#" AutoEventWireup="true" CodeBehind="CorridaExecutadaCorridaCompleta.aspx.cs" Inherits="LightSwitchApplication.WebForms.CorridaExecutadaCorridaCompleta" MasterPageFile="~/mainPrincipal.Master" %>
<%# Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="aja" %>
<asp:Content ContentPlaceHolderID="contentLinks" runat="server" ID="contentLinks">
<link href="../bootstrap-3.2.0-dist/css/bootstrap.min.css" rel="stylesheet" />
<script src="../bootstrap-3.2.0-dist/js/bootstrap.min.js" type="text/javascript"></script>
<script src="../jquery/jquery-2.1.1.min.js"></script>
<asp:ScriptManager ID="ScriptManager" runat="server"></asp:ScriptManager>
</asp:Content>
<asp:Content ContentPlaceHolderID="contentBody" ID="contentBody" runat="server">
<asp:Panel ID="Panl1" runat="server" CssClass="Popup" align="center" Style="display: none">
<iframe style="width: 850px; height: 500px;" id="irm1" src="EnderecoCorridaCorridaExecutadaCompleta.aspx?IdEnderecoCorrida=4201337" runat="server"></iframe>
<br />
<asp:Button ID="btnClose" runat="server" Text="Fechar" />
</asp:Panel>
<div class="container">
<div class="row">
<div class="col-sm-8">
<asp:Label runat="server" ID="lblCorrida" Text="Corrida: "></asp:Label>
<asp:DropDownList runat="server" ID="ddCorridas" Width="100%" DataTextField="NomeCompletoCorrida" DataValueField="Id"></asp:DropDownList>
</div>
<div class="col-sm-4">
<asp:Button runat="server" ID="btnProcurar" Text="Procurar" class="btn btn-info btn-default" OnClick="btnProcurar_Click" />
</div>
</div>
<hr />
<div class="row">
<asp:Repeater ID="repMovimentosCorridaExecutada" runat="server" OnItemDataBound="repMovimentosCorridaExecutada_ItemDataBound">
<HeaderTemplate>
<div class="col-sm-6">
<asp:Label runat="server" ID="lblNomeCorrida" Text="Nome da corrida: "></asp:Label>
</div>
<div class="col-sm-12">
<asp:TextBox runat="server" ID="txbNomeCorrida" Text='<%# NomeCorrida %>' Width="100%"></asp:TextBox>
</div>
<div class="col-sm-6">
<asp:Label runat="server" ID="lblMotorista" Text="Motorista: "></asp:Label>
</div>
<div class="col-sm-12">
<asp:TextBox runat="server" ID="txbMotorista" ReadOnly="true" Text='<%# NomeCompletoMotorista %> ' Width="100%"></asp:TextBox>
</div>
<tr>
<td colspan="6">
<hr />
</td>
</tr>
</HeaderTemplate>
<ItemTemplate>
<aja:ModalPopupExtender ID="mp1" runat="server" PopupControlID="Panl1" TargetControlID="btnAlterarOrigem"
CancelControlID="btnClose" BackgroundCssClass="Background">
</aja:ModalPopupExtender>
<div class="col-sm-4">
<div class="row">
<div class="col-sm-6">
<asp:Label runat="server" ID="lblTipoMovimentoCorridaExecutada" Text="Tipo de Movimento:"></asp:Label>
</div>
<div class="col-sm-12">
<asp:TextBox runat="server" ID="txbTipoMovimentoCorridaExecutada" Text='<%# Eval("NomeTipoMovimentoCorrida")%>' Width="100%"></asp:TextBox>
</div>
</div>
<div class="row">
<div class="col-sm-6">
<asp:Label runat="server" ID="lblEnderecoCompleto" Text="Endereço completo:"></asp:Label>
</div>
<div class="col-sm-12">
<asp:TextBox runat="server" ID="txbEnderecoOrigem" Text='<%# Eval("EnderecoOrigemCompleto")%>' Width="100%" ></asp:TextBox>
<asp:Button runat="server" ID="btnAlterarOrigem" Text="Alterar" CssClass="btn btn-default btn-info" OnClick="btnAlterarOrigem_Click" />
</div>
</div>
<div class="row">
<div class="col-sm-6">
<asp:Label runat="server" ID="lblEnderecoDestino" Text="Endereço completo:"></asp:Label>
</div>
<div class="col-sm-12">
<asp:TextBox runat="server" ID="txbEnderecoDestino" Text='<%# Eval("EnderecoOrigemCompleto")%>' Width="100%"></asp:TextBox>
<asp:Button runat="server" ID="btnAlterarDestino" Text="Alterar" CssClass="btn btn-default btn-info"/>
</div>
</div>
<div class="row">
<div class="col-sm-6">
<asp:Label runat="server" ID="lblDistanciaOrigemDestino" Text="Distância em KM:"></asp:Label>
</div>
<div class="col-sm-12">
<asp:TextBox runat="server" ID="txbDistanciaOrigemDestino" Text='<%# Eval("DistanciaOrigemDestino")%>' Width="100%"></asp:TextBox>
</div>
</div>
<div class="row">
<div class="col-sm-6">
<asp:Label runat="server" ID="lblTempoOrigemDestino" Text="Tempo em Mins."></asp:Label>
</div>
<div class="col-sm-12">
<asp:TextBox runat="server" ID="txbTempoOrigemDestino" Text='<%# Eval("TempoOrigemDestino")%>' Width="100%"></asp:TextBox>
</div>
</div>
</div>
</ItemTemplate>
</asp:Repeater>
</div>
</div>
and this second webform(the one opened as Popup)
<%# Page Language="C#" AutoEventWireup="true" CodeBehind="EnderecoCorridaCorridaExecutadaCompleta.aspx.cs" Inherits="LightSwitchApplication.WebForms.EnderecoCorridaCorridaExecutadaCompleta" MasterPageFile="~/mainPrincipal.Master" %>
<asp:Content ContentPlaceHolderID="contentBody" runat="server">
<asp:SqlDataSource runat="server" ID="sqlDataSourceEnderecoCorrida" ConnectionString="<%$ ConnectionStrings:SOSSemTempoData %>" ConflictDetection="CompareAllValues" DeleteCommand="DELETE FROM [EnderecoCorrida] WHERE [Id] = #original_Id AND [Logradouro] = #original_Logradouro AND [Numero] = #original_Numero AND [Bairro] = #original_Bairro AND (([CEP] = #original_CEP) OR ([CEP] IS NULL AND #original_CEP IS NULL)) AND [IdCidade] = #original_IdCidade AND (([IdVia] = #original_IdVia) OR ([IdVia] IS NULL AND #original_IdVia IS NULL)) AND (([Complemento] = #original_Complemento) OR ([Complemento] IS NULL AND #original_Complemento IS NULL)) AND (([EnderecoCompleto] = #original_EnderecoCompleto) OR ([EnderecoCompleto] IS NULL AND #original_EnderecoCompleto IS NULL))" InsertCommand="INSERT INTO [EnderecoCorrida] ([Logradouro], [Numero], [Bairro], [CEP], [IdCidade], [IdVia], [Complemento], [EnderecoCompleto]) VALUES (#Logradouro, #Numero, #Bairro, #CEP, #IdCidade, #IdVia, #Complemento, #EnderecoCompleto)" OldValuesParameterFormatString="original_{0}" ProviderName="System.Data.SqlClient" SelectCommand="SELECT [Id], [Logradouro], [Numero], [Bairro], [CEP], [IdCidade], [IdVia], [Complemento], [EnderecoCompleto] FROM [EnderecoCorrida] WHERE ([Id] = #Id)" UpdateCommand="UPDATE [EnderecoCorrida] SET [Logradouro] = #Logradouro, [Numero] = #Numero, [Bairro] = #Bairro, [CEP] = #CEP, [IdCidade] = #IdCidade, [IdVia] = #IdVia, [Complemento] = #Complemento, [EnderecoCompleto] = #EnderecoCompleto WHERE [Id] = #original_Id AND [Logradouro] = #original_Logradouro AND [Numero] = #original_Numero AND [Bairro] = #original_Bairro AND (([CEP] = #original_CEP) OR ([CEP] IS NULL AND #original_CEP IS NULL)) AND [IdCidade] = #original_IdCidade AND (([IdVia] = #original_IdVia) OR ([IdVia] IS NULL AND #original_IdVia IS NULL)) AND (([Complemento] = #original_Complemento) OR ([Complemento] IS NULL AND #original_Complemento IS NULL)) AND (([EnderecoCompleto] = #original_EnderecoCompleto) OR ([EnderecoCompleto] IS NULL AND #original_EnderecoCompleto IS NULL))">
<DeleteParameters>
<asp:Parameter Name="original_Id" Type="Int32" />
<asp:Parameter Name="original_Logradouro" Type="String" />
<asp:Parameter Name="original_Numero" Type="Int32" />
<asp:Parameter Name="original_Bairro" Type="String" />
<asp:Parameter Name="original_CEP" Type="String" />
<asp:Parameter Name="original_IdCidade" Type="Int32" />
<asp:Parameter Name="original_IdVia" Type="Int32" />
<asp:Parameter Name="original_Complemento" Type="String" />
<asp:Parameter Name="original_EnderecoCompleto" Type="String" />
</DeleteParameters>
<InsertParameters>
<asp:Parameter Name="Logradouro" Type="String" />
<asp:Parameter Name="Numero" Type="Int32" />
<asp:Parameter Name="Bairro" Type="String" />
<asp:Parameter Name="CEP" Type="String" />
<asp:Parameter Name="IdCidade" Type="Int32" />
<asp:Parameter Name="IdVia" Type="Int32" />
<asp:Parameter Name="Complemento" Type="String" />
<asp:Parameter Name="EnderecoCompleto" Type="String" />
</InsertParameters>
<SelectParameters>
<asp:QueryStringParameter Name="Id" QueryStringField="IdEnderecoCorrida" Type="Int32" />
</SelectParameters>
<UpdateParameters>
<asp:Parameter Name="Logradouro" Type="String" />
<asp:Parameter Name="Numero" Type="Int32" />
<asp:Parameter Name="Bairro" Type="String" />
<asp:Parameter Name="CEP" Type="String" />
<asp:Parameter Name="IdCidade" Type="Int32" />
<asp:Parameter Name="IdVia" Type="Int32" />
<asp:Parameter Name="Complemento" Type="String" />
<asp:Parameter Name="EnderecoCompleto" Type="String" />
<asp:Parameter Name="original_Id" Type="Int32" />
<asp:Parameter Name="original_Logradouro" Type="String" />
<asp:Parameter Name="original_Numero" Type="Int32" />
<asp:Parameter Name="original_Bairro" Type="String" />
<asp:Parameter Name="original_CEP" Type="String" />
<asp:Parameter Name="original_IdCidade" Type="Int32" />
<asp:Parameter Name="original_IdVia" Type="Int32" />
<asp:Parameter Name="original_Complemento" Type="String" />
<asp:Parameter Name="original_EnderecoCompleto" Type="String" />
</UpdateParameters>
</asp:SqlDataSource>
<asp:DetailsView runat="server" ID="dvEnderecoCorrida" DataSourceID="sqlDataSourceEnderecoCorrida">
</asp:DetailsView>
My Repeater Control havea few items, and i need to exchange data between my base form and my Popup. The button that shows the popup is btnAlterarOrigem, and there is an ID for each record that each ItemTemplate represents. I need to send to the popup info from which ItemTemplate opened the popup and show some data.
How can i exchange information between them?
How can i make this (Filter GridView with DropDownList using FilterExpression in SqlDataSource) work without reloading the page using JavaScript ?
<asp:DropDownList ID="ddlCountries" runat="server" AutoPostBack="True" DataSourceID="DropDownDataSource"
DataTextField="SC" DataValueField="SC" AppendDataBoundItems="True">
<asp:ListItem Text="All " Value="" />
</asp:DropDownList>
<asp:SqlDataSource ID="DropDownDataSource" runat="server" ConnectionString="<%$ ConnectionStrings:CountConnectionString %>"
SelectCommand="SELECT [SC] FROM [CountTable]"></asp:SqlDataSource>
<asp:GridView ID="GridView1" HeaderStyle-BackColor="#3AC0F2" HeaderStyle-ForeColor="White"
runat="server" AutoGenerateColumns="False" DataSourceID="GridDataSource"
DataKeyNames="ID">
<Columns>
<asp:BoundField DataField="ID" HeaderText="ID" ItemStyle-Width="150"
InsertVisible="False" ReadOnly="True" SortExpression="ID" />
<asp:BoundField DataField="SC" HeaderText="SC" ItemStyle-Width="150"
SortExpression="SC" />
<asp:BoundField DataField="Traffic" HeaderText="Traffic"
SortExpression="Traffic" />
</Columns>
<HeaderStyle BackColor="#3AC0F2" ForeColor="White"></HeaderStyle>
</asp:GridView>
<asp:SqlDataSource ID="GridDataSource" runat="server" ConnectionString="<%$ ConnectionStrings:CountConnectionString %>"
SelectCommand="SELECT * FROM [CountTable]" FilterExpression="SC = '{0}'">
<FilterParameters>
<asp:ControlParameter Name="SC" ControlID="ddlCountries" PropertyName="SelectedValue" />
</FilterParameters>
</asp:SqlDataSource>
I have been using RadTreeList in one of my project, I have used RadUpload Control which lies inside the EditFormSettings of the RadTreeList. I have used javascript for validating RadUpload control (i.e. where user has selected any file or not), now the problem here is that I'm not able to find/get the RadUpload control inside the RadTreeList in my javascript, though I'm getting the RadTreeList control.
Below is my code :-
function IsFilesSelected(source, args) {
debugger;
args.IsValid = true;
var treeList = $find("<%= FAQRadTreeList.ClientID %>");
var RadUpload = treeList._findChildControl.getName("UploadDocumentRadUpload");
var UploadLabel = treeList.selectItem(ImageExtensionLabel);
var FileInputs = RadUpload.getFileInputs();
for (var i = 0; i < FileInputs.length; i++) {
if (FileInputs[i].value && FileInputs[i].value.length > 0) {
args.IsValid = true;
}
else {
if (UploadLabel == null || UploadLabel.innerHTML == '')
args.IsValid = false;
else
args.IsValid = true;
}
}
}
While my RadTreeList is shown as :--
<telerik:RadTreeList ID="FAQRadTreeList" runat="server" AllowPaging="True" DataSourceID="FAQSqlDataSource"
PageSize="20" DataKeyNames="FAQ_ID" ParentDataKeyNames="FAQ_Parent_ID" AutoGenerateColumns="False"
Width="100%" OnInsertCommand="FAQRadTreeList_InsertCommand" OnItemCommand="FAQRadTreeList_ItemCommand"
OnItemDataBound="FAQRadTreeList_ItemDataBound" OnUpdateCommand="FAQRadTreeList_UpdateCommand"
OnItemDrop="FAQRadTreeList_ItemDrop">
<PagerStyle Mode="NextPrevNumericAndAdvanced" />
<Columns>
<telerik:TreeListEditCommandColumn UniqueName="InsertCommandColumn" ButtonType="ImageButton"
AddRecordText="Add" ShowEditButton="true" ItemStyle-CssClass="MyImageButton">
<ItemStyle HorizontalAlign="Left" VerticalAlign="Top" Width="60px" />
<HeaderStyle VerticalAlign="Top" HorizontalAlign="Left" Width="60px" />
</telerik:TreeListEditCommandColumn>
<telerik:TreeListTemplateColumn DataField="FAQ_Title" UniqueName="FAQ_Title" HeaderText="Title">
<ItemTemplate>
<asp:Label ID="FAQTitleLabel" runat="server" Text='<%# Bind("FAQ_Title") %>'></asp:Label>
</ItemTemplate>
<ItemStyle HorizontalAlign="Left" VerticalAlign="Top" Width="120px" />
<HeaderStyle HorizontalAlign="Left" VerticalAlign="Top" Width="120px" />
</telerik:TreeListTemplateColumn>
<telerik:TreeListTemplateColumn DataField="FAQ_Description" UniqueName="FAQ_Description"
HeaderText="Description">
<ItemTemplate>
<asp:Label ID="FAQDescriptionLabel" runat="server" Text='<%# ( Eval("FAQ_Description").ToString().Length > 150)? string.Concat(Eval("FAQ_Description").ToString().Substring(0, 150), ".....") : Eval("FAQ_Description") %>'></asp:Label>
<telerik:RadToolTip ID="FAQDescriptionRadToolTip" TargetControlID='<%# ( Eval("FAQ_Description").ToString().Length > 150)? "FAQDescriptionLabel" : "" %>'
Width="400px" Height="300px" ContentScrolling="Y" runat="server" HideDelay="1000"
Position="TopCenter" RelativeTo="Element" ShowDelay="1000">
<%# Eval("FAQ_Description")%>
</telerik:RadToolTip>
</ItemTemplate>
<ItemStyle HorizontalAlign="Left" VerticalAlign="Top" />
<HeaderStyle HorizontalAlign="Left" VerticalAlign="Top" />
</telerik:TreeListTemplateColumn>
<telerik:TreeListTemplateColumn DataField="ParentName" UniqueName="ParentName" HeaderText="Parent Item">
<ItemTemplate>
<asp:Label ID="ParentTitleLabel" runat="server" Text='<%# Bind("ParentName") %>'></asp:Label>
</ItemTemplate>
<ItemStyle HorizontalAlign="Left" VerticalAlign="Top" Width="100px" />
<HeaderStyle HorizontalAlign="Left" VerticalAlign="Top" Width="100px" />
</telerik:TreeListTemplateColumn>
<telerik:TreeListTemplateColumn DataField="FAQ_Order" UniqueName="FAQ_Order" HeaderText="Order">
<ItemTemplate>
<telerik:RadNumericTextBox ID="FAQOrderRadNumericTextBox" MinValue="1" NumberFormat-DecimalDigits="0"
Enabled="false" runat="server" Width="50px" Text='<%# Bind("FAQ_Order") %>'>
<EnabledStyle Font-Names="Verdana" HorizontalAlign="Right" />
</telerik:RadNumericTextBox>
</ItemTemplate>
<ItemStyle HorizontalAlign="Center" VerticalAlign="Top" Width="60px" />
<HeaderStyle HorizontalAlign="Center" VerticalAlign="Top" Width="60px" />
</telerik:TreeListTemplateColumn>
<telerik:TreeListTemplateColumn HeaderText="Status" DataField="FAQ_ActiveStatus"
UniqueName="FAQ_ActiveStatus">
<ItemTemplate>
<asp:Label ID="ActiveStatusLabel" runat="server" CssClass='<%# (Convert.ToBoolean(Eval("FAQ_ActiveStatus"))) ? "active" : "inactive" %>'
ToolTip='<%# (Convert.ToBoolean(Eval("FAQ_ActiveStatus"))) ? "Active" : "Inactive" %>'
Text=" "></asp:Label>
</ItemTemplate>
<ItemStyle HorizontalAlign="Center" VerticalAlign="Top" Width="60px" />
<HeaderStyle HorizontalAlign="Center" VerticalAlign="Top" Width="60px" />
</telerik:TreeListTemplateColumn>
<telerik:TreeListTemplateColumn DataField="FAQ_ActiveStatus" HeaderText="Action"
UniqueName="ActiveStatus">
<ItemTemplate>
<asp:ImageButton ID="ActiveInactiveButton" runat="server" ToolTip='<%# (Convert.ToBoolean(Eval("FAQ_ActiveStatus"))) ? "Make inactive" : "Make active" %>'
Width="14px" Height="14px" CommandName="ActiveInactive" ImageUrl='<%# (Convert.ToBoolean(Eval("FAQ_ActiveStatus"))) ? "../App_Themes/ELPISCMS/images/inactive.png" : "../App_Themes/ELPISCMS/images/active.png" %>' />
</ItemTemplate>
<ItemStyle HorizontalAlign="Center" VerticalAlign="Top" Width="60px" />
<HeaderStyle HorizontalAlign="Center" VerticalAlign="Top" Width="60px" />
</telerik:TreeListTemplateColumn>
</Columns>
<EditFormSettings EditFormType="Template" PopUpSettings-Width="100%">
<FormTemplate>
<asp:Panel ID="DetailsPanel" runat="server" DefaultButton="SaveRadButton">
<table border="0" cellpadding="0" cellspacing="5" class="innertable">
<tr>
<td class="td18">
Title : <span class="mandatorymark">*</span>
</td>
<td class="td82">
<telerik:RadTextBox ID="FAQTitleRadTextBox" runat="server" SkinID="FAQTitleRadTextBox">
</telerik:RadTextBox>
<asp:RequiredFieldValidator ID="ReferenceTitleRequiredFieldValidator" runat="server"
ValidationGroup="FAQValidationGroup" Display="Dynamic" SetFocusOnError="true"
ControlToValidate="FAQTitleRadTextBox" CssClass="requiredfield" ErrorMessage="Required!"></asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td class="td18">
Description : <span class="mandatorymark">*</span>
</td>
<td class="td82">
<telerik:RadTextBox ID="FAQDescriptionRadTextBox" runat="server" TextMode="MultiLine"
Rows="8" SkinID="FAQDescriptionRadTextBox">
</telerik:RadTextBox>
<%-- <telerik:RadEditor ID="ReferenceDescriptionRadEditor" runat="server" AutoResizeHeight="false"
EnableResize="false" OnClientLoad="OnClientLoad" EditModes="Design, Html" AllowScripts="false"
ContentFilters="RemoveScripts,MakeUrlsAbsolute,FixUlBoldItalic,FixEnclosingP,IECleanAnchors,MozEmStrong,ConvertFontToSpan,ConvertToXhtml,IndentHTMLContent"
NewLineBr="true" StripFormattingOptions="AllExceptNewLines" StripFormattingOnPaste="AllExceptNewLines"
Height="600px" Width="700px">
<ImageManager ViewPaths="~/uploads/editoruploadimages" UploadPaths="~/uploads/editoruploadimages"
DeletePaths="~/uploads/editoruploadimages" />
<CssFiles>
<telerik:EditorCssFile Value="" />
</CssFiles>
<ContextMenus>
<telerik:EditorContextMenu Enabled="true">
<telerik:EditorTool Name="Cut" />
<telerik:EditorTool Name="Copy" />
<telerik:EditorTool Name="Paste" />
</telerik:EditorContextMenu>
</ContextMenus>
<Tools>
<telerik:EditorToolGroup>
<telerik:EditorTool Name="AjaxSpellCheck" />
<telerik:EditorTool Name="FindAndReplace" />
<telerik:EditorTool Name="SelectAll" />
<telerik:EditorTool Name="Cut" />
<telerik:EditorTool Name="Copy" />
<telerik:EditorTool Name="Paste" />
<telerik:EditorTool Name="Redo" />
<telerik:EditorTool Name="Undo" />
<telerik:EditorTool Name="InsertLink" />
</telerik:EditorToolGroup>
<telerik:EditorToolGroup>
<telerik:EditorTool Name="Bold" />
<telerik:EditorTool Name="Italic" />
<telerik:EditorTool Name="Underline" />
</telerik:EditorToolGroup>
<telerik:EditorToolGroup>
<telerik:EditorTool Name="FontName" />
<telerik:EditorTool Name="RealFontSize" />
<telerik:EditorTool Name="ApplyClass" />
</telerik:EditorToolGroup>
<telerik:EditorToolGroup>
<telerik:EditorTool Name="ForeColor" />
<telerik:EditorTool Name="BackColor" />
<telerik:EditorTool Name="FormatStripper" />
</telerik:EditorToolGroup>
<telerik:EditorToolGroup>
<telerik:EditorTool Name="InsertAnchor" />
<telerik:EditorTool Name="InsertCustomLink" />
<telerik:EditorTool Name="InsertDate" />
<telerik:EditorTool Name="InsertGroupbox" />
<telerik:EditorTool Name="InsertHorizontalRule" />
<telerik:EditorTool Name="InsertUnorderedList" />
<telerik:EditorTool Name="InsertOrderedList" />
<telerik:EditorTool Name="Paragraph" />
<telerik:EditorTool Name="InsertTable" />
<telerik:EditorTool Name="InsertSnippet" />
</telerik:EditorToolGroup>
<telerik:EditorToolGroup>
<telerik:EditorTool Name="Indent" />
<telerik:EditorTool Name="Outdent" />
<telerik:EditorTool Name="JustifyRight" />
<telerik:EditorTool Name="JustifyLeft" />
<telerik:EditorTool Name="JustifyCenter" />
</telerik:EditorToolGroup>
<telerik:EditorToolGroup>
<telerik:EditorTool Name="LinkManager" />
<telerik:EditorTool Name="ImageManager" />
<telerik:EditorTool Name="ImageMapDialog" />
<telerik:EditorTool Name="DocumentManager" />
<telerik:EditorTool Name="ConvertToLower" />
<telerik:EditorTool Name="ConvertToUpper" />
<telerik:EditorTool Name="ToggleScreenMode" />
</telerik:EditorToolGroup>
</Tools>
</telerik:RadEditor>
<div style="float: right;">
<span id="counter" style="text-align: right;"></span>
</div>--%>
<asp:RequiredFieldValidator ID="FAQDescriptionRequiredFieldValidator" runat="server"
ValidationGroup="FAQValidationGroup" Display="Dynamic" SetFocusOnError="true"
ControlToValidate="FAQDescriptionRadTextBox" CssClass="requiredfield" ErrorMessage="Required!"></asp:RequiredFieldValidator>
</td>
</tr>
<td class="td18">
Upload Document : <span class="mandatorymark">*</span>
</td>
<td class="td82">
<telerik:RadUpload ID="UploadDocumentRadUpload" runat="server" ControlObjectsVisibility="AddButton,RemoveButtons"
InputSize="50" AllowedFileExtensions=".png,.jpg,.jpeg,.gif" oncontextmenu="return false;"
onpaste="return false;" ReadOnlyFileInputs="true"/>
<span style="line-height: 15px; vertical-align: top;">
<asp:Label ID="ImageExtensionLabel" runat="server" Text="<br/>(Only .PNG,.JPG,.JPEG,.GIF images allowed)" />
<br />
<asp:Label runat="server" ID="ImageNameLabel" Visible="false" />
</span>
<br />
<telerik:RadProgressArea ID="UploadDocumentRadProgressArea" runat="server" ProgressIndicators="CurrentFileName">
</telerik:RadProgressArea>
<asp:CustomValidator ID="IsFilesSelectedCustomValidator" runat="server" ClientValidationFunction="IsFilesSelected"
Display="Dynamic" SetFocusOnError="true" CssClass="requiredfield" ValidationGroup="FAQValidationGroup"
ErrorMessage="Required!"></asp:CustomValidator>
<asp:CustomValidator ID="ValidateExtensionCustomValidator" runat="server" ClientValidationFunction="validateImageRadUpload"
Display="Dynamic" SetFocusOnError="true" CssClass="requiredfield" ValidationGroup="FAQValidationGroup"
ErrorMessage="<br/>(Only .PNG,.JPG,.JPEG,.GIF images allowed)"></asp:CustomValidator>
</td>
<tr>
<td>
</td>
<td class="td82">
<telerik:RadGrid ID="FilesRadGrid" runat="server" AllowFilteringByColumn="True" AllowPaging="True"
AllowSorting="True" AutoGenerateColumns="False" CellSpacing="0" DataSourceID="FilesSqlDataSource"
GridLines="None" Width="530px" Visible="false" OnItemCommand="FilesRadGrid_ItemCommand">
<MasterTableView DataKeyNames="FAQ_Uploads_ID" DataSourceID="FilesSqlDataSource">
<RowIndicatorColumn FilterControlAltText="Filter RowIndicator column">
<HeaderStyle Width="20px" />
</RowIndicatorColumn>
<ExpandCollapseColumn FilterControlAltText="Filter ExpandColumn column">
<HeaderStyle Width="20px" />
</ExpandCollapseColumn>
<Columns>
<telerik:GridBoundColumn DataField="FileName" FilterControlAltText="Filter FileName column"
HeaderText="File Name" SortExpression="FileName" UniqueName="FileName" FilterControlWidth="80%">
<HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" />
<ItemStyle HorizontalAlign="Left" Font-Size="11px" Font-Names="Arial" VerticalAlign="Middle" />
</telerik:GridBoundColumn>
<telerik:GridTemplateColumn HeaderText="Action" AllowFiltering="false">
<ItemTemplate>
<asp:ImageButton ID="DeleteImageButton" runat="server" ToolTip="Delete" CommandName="Del"
ImageUrl="~/App_Themes/ELPISCMS/images/delete.png" OnClientClick="if (!confirm('Are you sure, you want to delete this record?')) {return false;}"
CommandArgument='<%# Eval("FAQ_Uploads_ID") +":"+ Eval("FAQ_Uploads_ID") %>' />
</ItemTemplate>
<ItemStyle HorizontalAlign="Center" VerticalAlign="Middle" Width="50px" />
<HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" Width="50px" />
</telerik:GridTemplateColumn>
</Columns>
<EditFormSettings>
<EditColumn FilterControlAltText="Filter EditCommandColumn column" />
</EditFormSettings>
</MasterTableView>
<FilterMenu EnableImageSprites="False" />
<HeaderContextMenu CssClass="GridContextMenu GridContextMenu_Default" />
</telerik:RadGrid>
<asp:SqlDataSource ID="FilesSqlDataSource" runat="server" ConnectionString="<%$ ConnectionStrings:elpis_cmsConnectionString %>"
SelectCommand="Usp_FAQ_Uploads_Select" SelectCommandType="StoredProcedure">
<SelectParameters>
<asp:ControlParameter ConvertEmptyStringToNull="true" ControlID="FAQIDHiddenField"
DbType="Int32" Name="FAQ_ID" PropertyName="Value" />
</SelectParameters>
</asp:SqlDataSource>
</td>
</tr>
<tr>
<td class="td18">
Status :
</td>
<td class="td82">
<asp:RadioButton ID="ActiveRadioButton" runat="server" CssClass="radiobutton" Checked="true"
GroupName="ActiveInactive" />Active
<asp:RadioButton ID="InactiveRadioButton" runat="server" CssClass="radiobutton" GroupName="ActiveInactive" />Inactive
</td>
</tr>
<tr>
<td>
</td>
<td class="td82">
<telerik:RadButton ID="SaveRadButton" runat="server" Text='<%# (Container is TreeListEditFormInsertItem) ? "Save" : "Update" %>'
CausesValidation="true" CommandName='<%# (Container is TreeListEditFormInsertItem) ? "PerformInsert" : "Update" %>'
ValidationGroup="FAQValidationGroup" Width="80px">
<Icon PrimaryIconUrl="~/App_Themes/ELPISCMS/images/save2.png" PrimaryIconLeft="5"
PrimaryIconTop="3" />
</telerik:RadButton>
<telerik:RadButton ID="CancelRadButton" runat="server" Text="Cancel" CommandName="Cancel"
CausesValidation="false" Width="80px">
<Icon PrimaryIconUrl="~/App_Themes/ELPISCMS/images/cancel2.png" PrimaryIconLeft="5"
PrimaryIconTop="3" />
</telerik:RadButton>
</td>
</tr>
</table>
</asp:Panel>
</FormTemplate>
</EditFormSettings>
<ClientSettings AllowItemsDragDrop="true">
<Selecting AllowItemSelection="True" />
</ClientSettings>
</telerik:RadTreeList>
<asp:SqlDataSource ID="FAQSqlDataSource" runat="server" ConnectionString="<%$ ConnectionStrings:elpis_cmsConnectionString %>"
SelectCommand="Usp_FAQ_Select" SelectCommandType="StoredProcedure"></asp:SqlDataSource>
Can anyone help me ?
Thanks