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?
Related
I am trying hard to change the color of a text when it is clicked but not getting success.
There is one label for question, four labels for four options, one label for correct answer and one label for explanation.
What I am trying is when user click on any option then it should match with the correct answer and change the color of the text of that option i.e. when the answer is correct the text color should turn to green otherwise the color should turn to red .
But when I click on any option it is turning to red color only . Correct option should turn to green but it is turning to red . I can't figure out why ?.
Have a look at my code. Show me where I am making mistake and what is the solution.
.aspx :-
<%# Page Title="" Language="C#" MasterPageFile="~/Student/StudentPage.master" AutoEventWireup="true" CodeFile="studpractice.aspx.cs" Inherits="Student_studpractice" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
<script type="text/javascript">
$(function () {
$(".optionclass").click(function () {
var $thisoption = $(this);
var $corrans = $(".correctans");
if ($thisoption.text() == $corrans.text()) {
$thisoption.css("color", "green");
} else {
$thisoption.css("color", "red");
}
});
});
</script>
<div>
<div id="tabs">
<ul>
<li>Reasoning</li>
<li>Quantitative Aptitude</li>
<li>English</li>
<li>Mathematics</li>
<li>Computer Concepts</li>
</ul>
<div id="tabs-1">
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="false" width="100%">
<Columns>
<asp:TemplateField>
<ItemTemplate>
<asp:Panel ID="Panel1" runat="server">
<asp:Label ID="Label1" runat="server" Text='<%#Eval("Question") %>'></asp:Label>
<br />
<br />
<br />
<span>A-</span> <asp:Label class="optionclass" ID="Label2" runat="server" Text='<%#Eval("Option1")%>' ></asp:Label>
<br />
<br />
<span>B-</span> <asp:Label class="optionclass" ID="Label3" runat="server" Text='<%#Eval("Option2")%>'></asp:Label>
<br />
<br />
<span>C-</span> <asp:Label class="optionclass" ID="Label4" runat="server" Text='<%#Eval("Option3")%>'></asp:Label>
<br />
<br />
<span>D-</span> <asp:Label class="optionclass" ID="Label5" runat="server" Text='<%#Eval("Option4")%>'></asp:Label>
<br />
<br />
<asp:Button class="panelButton" runat="server" Text="Show Answer" ClientIDMode="Static" />
<br />
<asp:Panel ID="anspanel" class="AnswerPanel" runat="server" ClientIDMode="Static">
<span>Correct Answer is :-</span><asp:Label class="correctans" ID="Label6" runat="server" Text='<%#Eval("CorrectAns")%>'></asp:Label>
<br />
<br />
<asp:Label ID="Label7" runat="server" Text='<%#Eval("Explanation")%>'></asp:Label>
</asp:Panel>
</asp:Panel>
<br />
<br />
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
</div>
<div id="tabs-2">
<asp:GridView ID="GridView2" runat="server" AutoGenerateColumns="false" >
<Columns>
<asp:TemplateField>
<ItemTemplate>
<asp:Panel ID="Panel1" runat="server">
<asp:Label ID="Label1" runat="server" Text='<%#Eval("Question") %>'></asp:Label>
<br />
<br />
<br />
<span>A-</span> <asp:Label class="optionclass" ID="Label2" runat="server" Text='<%#Eval("Option1")%>'></asp:Label>
<br />
<br />
<span>B-</span> <asp:Label class="optionclass" ID="Label3" runat="server" Text='<%#Eval("Option2")%>'></asp:Label>
<br />
<br />
<span>C-</span> <asp:Label class="optionclass" ID="Label4" runat="server" Text='<%#Eval("Option3")%>'></asp:Label>
<br />
<br />
<span>D-</span> <asp:Label class="optionclass" ID="Label5" runat="server" Text='<%#Eval("Option4")%>'></asp:Label>
<br />
<br />
<asp:Button class="panelButton" runat="server" Text="Show Answer" ClientIDMode="Static" />
<br />
<asp:Panel ID="anspanel" class="AnswerPanel" runat="server" ClientIDMode="Static">
<span>Correct Answer is :-</span><asp:Label class="correctans" ID="Label6" runat="server" Text='<%#Eval("CorrectAns")%>'></asp:Label>
<br />
<br />
<asp:Label ID="Label7" runat="server" Text='<%#Eval("Explanation")%>'></asp:Label>
</asp:Panel>
</asp:Panel>
<br />
<br />
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
</div>
<div id="tabs-3">
Tab 3 Content
</div>
<div id="tabs-4">
Tab 4 Content
</div>
<div id="tabs-5">
Tab 5 Content
</div>
</div>
<input type="button" id="btnPrevious" value="Previous" style = "display:none"/>
<input type="button" id="btnNext" value="Next" />
</div>
</asp:Content>
So what wrong you are doing is you are selecting all .correctans and what you should do is select the .correctans specific to that question only.
Change $(".correctans") to $(".correctans")[0] or $(".correctans").first() to get the single correctans element instead of a collection.
EDIT:
Since you have multiple questions and answers on the page, use this to get the correctans for the question they're answering:
var $corrans = $(this).parent().find('.correctans:first');
I have a web form where the user chooses a date range and it binds the data to a grid view. When I run the web form, the title of each grid as well as its option to export as an excel file is shown. Is there a way in HTML to hide those elements until the user selects the data range and the DataGrids appear? EXAMPLE
The "Report Text" is the title of each datagrid. Is there a way to hide the export buttons and titles until the user submits the date? The date fields is a javascript datepicker I am trying to see if the issue lies within the javascript or the HTML itself.
EDIT: I'll add my HTML Code
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<style type="text/css">
.auto-style1 {
width: 382px;
height: 96px;
}
</style>
</head>
<body>
<form id="form1" runat="server"
<meta http-equiv="content-type" content="text/html"; charset="utf-8" />
<link rel="stylesheet"
href="http://code.jquery.com/ui/1.11.0/themes/smoothness/jquery-ui.css" />
<script src="http://code.jquery.com/jquery-1.10.2.js"></script>
<script src="http://code.jquery.com/ui/1.11.0/jquery-ui.js"></script>
<script type="text/javascript" lang="javascript">
$(function () {
$("#<%=TextDateFrom.ClientID %>").datepicker({
changeMonth: true,
changeYear: true,
changeDate: true,
});
});
$(function(){
$("#<%=TextDateTo.ClientID %>").datepicker({
changeMonth: true,
changeYear: true,
changeDate: true,
});
});
</script>
<asp:Label ID="Header" runat="server"><b>Tax Report App</b> </asp:Label>
<br />
<br />
<br />
<asp:Label ID="StartDate" runat="server">Begin Date: </asp:Label>
<asp:TextBox ID="TextDateFrom" runat="server"></asp:TextBox><br />
<asp:Label ID="EndDate" runat="server"> End Date: </asp:Label>
<asp:TextBox ID="TextDateTo" runat="server"></asp:TextBox><br />
<asp:Button ID="Button1" runat="server" OnClick="Button1_Click" Text="Submit" />
<br />
<br />
<br />
<asp:Label ID="Label1" runat="server">Report Text </asp:Label>
<asp:GridView ID ="GridViewCS" runat="server" AutoGenerateColumns ="false">
<HeaderStyle BackColor="#3090C7" Font-Bold="True" ForeColor="White" />
<Columns>
<asp:BoundField DataField="State" HeaderText="State" ItemStyle- Width="200px" />
<asp:BoundField DataField="Total" HeaderText="Total Tax" ItemStyle-Width="200px" />
<asp:BoundField DataField="Total Sales" HeaderText="Total Sales" ItemStyle-Width="200px" />
<asp:BoundField DataField="Complete Total" HeaderText="Total with Tax" ItemStyle-Width="200px" />
</Columns>
</asp:GridView>
<br />
<asp:Button class="initial-hide" ID="btnExport" runat="server" Text="Export To Excel" OnClick = "ExportToExcel" />
<br />
<br />
<br />
<br />
<asp:Label ID="Label3" runat="server">Report Text </asp:Label>
<asp:GridView ID ="GridView2" runat="server" AutoGenerateColumns ="false">
<HeaderStyle BackColor="#3090C7" Font-Bold="True" ForeColor="White" />
<Columns>
<asp:BoundField DataField="FL" HeaderText="State FL" ItemStyle-Width="200px" />
<asp:BoundField DataField="Total FL" HeaderText="Sales Tax Amount FL" ItemStyle-Width="200px" />
<asp:BoundField DataField="Total Sales" HeaderText="Tax Exemption FL" ItemStyle-Width="200px" />
<asp:BoundField DataField="Complete Total" HeaderText="Total Sales FL" ItemStyle-Width="200px" />
</Columns>
</asp:GridView>
<br />
<asp:Button ID="Button2" runat="server" Text="Export To Excel" OnClick = "ExportToExcelFL" />
<div>
</div>
</form>
</body>
</html>
You can use Hide() and Show() effect of jQuery to hide and show elements
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?
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">
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