I'm using telerik:Radgrid and column which contains these sample values
Column 1
Female
Male
Female
Female
Male
The result must be displayed using the labels.
<asp:Label runat="server" ID="totalFandM" />
<asp:Label runat="server" ID="totalF" />
<asp:Label runat="server" ID="totalM" />
How can I display the values on the label using jquery?
It should display like this.
totalFandM - 5
totalF - 3
totalM - 2
items on radgrid
<telerik:GridBoundColumn HeaderText="Gender" SortExpression="Status" DataField="Gender"
UniqueName="Gender">
<telerik:RadComboBox ID="rcbGender" runat="server"
SelectedValue='<%# ((GridItem)Container).OwnerTableView.GetColumn("Gender").CurrentFilterValue %>'>
<Items>
<telerik:RadComboBoxItem Text="All" />
<telerik:RadComboBoxItem Text="Male" Value="Male" />
<telerik:RadComboBoxItem Text="Female" Value="Female" />
</Items>
</telerik:RadComboBox>
</telerik:GridBoundColumn>
Lets say your generated HTML is
<li>Female</li><li>Male</li><li>Female</li><li>Female</li><li>Male</li>
then
$(li).length
will give you the totalFandM
$(li:contains('Female')).length
will give you totalF
$(li:contains('Male')).length
will give you totalM
Related
I'm using one datalist - "datalist2" in that I have "RepeatColumns="5". I need a separator template or line after a one line which contains 5 items. I need a separator after 5 items.
<asp:DataList ID="DataList2" runat="server" RepeatColumns="5" GridLines="None" CellSpacing="5" CellPadding="10">
<ItemStyle HorizontalAlign="Center" />
<ItemTemplate>
<asp:ImageButton ID="ImageButton1" runat="server" ImageUrl='<%#"~/images//"+ Eval("image") %>' PostBackUrl='<%# Eval("p_id", "p_Details.aspx?ProductID={0}") %>' Height="240px" Width="180px" /><br /><br />
<asp:Label ID="NameLabel" runat="server" Text='<%# Eval("p_name") %>' style="font-family:Arial;font-size:12px;"></asp:Label><br /><br />
<asp:Label ID="PriceLabel" runat="server" Text='<%# "Rs."+ Eval("unit_price") %>' ForeColor="Red" style="font-family:Arial;font-size:12px;"></asp:Label>
<asp:Label ID="Discount" runat="server" Text='<%#"Rs." + "( " + Eval("discount") + "% " + " )" %>' ForeColor="Red" style="font-family:Arial;font-size:12px;" ></asp:Label><br />
<asp:Button CssClass="orange-btn" ID="LBCart" runat="server" Text="View" onclick="LBCart_Click" />
<asp:Button CssClass="orange-btn" ID="Button1" runat="server" Text="Add to Cart" OnClick="Button1_Click" /><br />
<br />
</ItemTemplate>
<SeparatorTemplate>
<hr />
</SeparatorTemplate>
</asp:DataList>
<asp:DataList>
<SeparatorTemplate>
<hr />
</SeparatorTemplate>
</asp:DataList>
Use the <hr> tag at the end of your item template in the DataList. That will display a line as a separator. You can then style it as per your requirement.
It displays like this :
There is a similar question in the SO website - Row separator in datalist.
The answer which apparently worked had worked with CSS border applied to row in the ItemTemplate i.e the <td/> element.
In line with the discussion in that thread, SeperatorTemplate of DataList is to seperate items not the rows. MSDN document - https://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.datalist.separatortemplate%28v=vs.110%29.aspx also talks in that line.
I use EntityDataSource.
When I want to insert into the "ShiftDetails" table with the following data: (3,1,04:00:00)
It is inserted fine if I use:
<telerik:GridBoundColumn DataField="startTime" HeaderText="startTime" SortExpression="startTime"
UniqueName="startTime" DataType="System.TimeSpan" EmptyDataText="00:00:00" >
When I try this with templatefield, the startTime is 00:00:00 instead of 04:00:00
<telerik:GridTemplateColumn HeaderText="startTime" >
<ItemTemplate>
<asp:Label runat="server" ID="lblstartTime" Text='<%# Eval("startTime")%>'></asp:Label>
</ItemTemplate>
<InsertItemTemplate>
<telerik:RadDateInput ID="txt_startTime" runat="server" DbSelectedDate='<%# Eval("startTime","{0:hh\\:mm\\:ss}") %>' DateFormat="HH:mm:ss" DisplayDateFormat="HH:mm:ss"
Culture="English (United States)" LabelWidth="64px"
Width="160px" Height="20px" EmptyMessage="!">
<EmptyMessageStyle ForeColor="Red" />
</telerik:RadDateInput>
</InsertItemTemplate>
<EditItemTemplate>
<telerik:RadDateInput ID="txt_startTime" runat="server" DateFormat="HH:mm:ss" DisplayDateFormat="HH:mm:ss"
Culture="English (United States)" LabelWidth="64px"
Width="160px" Height="20px" EmptyMessage="!">
<EmptyMessageStyle ForeColor="Red" />
</telerik:RadDateInput>
</EditItemTemplate>
</telerik:GridTemplateColumn>
My rad grid is master-details
the source of the details :
<ef:EntityDataSource ID="GetSourceDetail" runat="server" ContextTypeName="ResidenceShift.RShiftEntities" EntitySetName="ShiftDetails" EnableDelete="True" EnableFlattening="False" EnableInsert="True" EnableUpdate="True" ConnectionString="name=RShiftEntities" DefaultContainerName="RShiftEntities" AutoGenerateWhereClause="True" Include="ResidenceShift,ShiftType" AutoPage="False" AutoSort="False" EntityTypeFilter="" Select="" Where="" >
<WhereParameters>
<asp:SessionParameter DefaultValue="0" Name="shiftId" SessionField="shiftId" DbType="Int32" />
</WhereParameters>
</ef:EntityDataSource>
Why does it work fine with the bound field and then fails with the template field?!
Try using RadDateTimePicker instead, as it should also submit the time.
So I have a dropdownlist with 2 items : Path and Queue
If the item selected is a Path, then the next thing displayed in the next div is a textBox (txtLocation), and if it is a Queue, then I have to show a DropDownList(cmbLocation) which items are part of a xml file.
Type:
<dx:ASPxComboBox ID="cmbPathType" runat="server" Width="150px" TextField="TypeName"
ValueField="QueueMonitorConfigTypesID">
<DisabledStyle BackColor="LightGray" ForeColor="Black" />
<Items>
<dx:ListEditItem Text="Path" Value="Path" />
<dx:ListEditItem Text="Queue" Value="Queue" />
</Items>
<ValidationSettings ValidateOnLeave="false" RequiredField-IsRequired="true">
<RequiredField IsRequired="True" />
</ValidationSettings>
</dx:ASPxComboBox>
Location:
<dx:ASPxTextBox ID="txtLocation" runat="server" Width="150px">
<DisabledStyle BackColor="LightGray" ForeColor="Black" />
<ValidationSettings ValidateOnLeave="false" RequiredField-IsRequired="true">
<RequiredField IsRequired="True"></RequiredField>
</ValidationSettings>
</dx:ASPxTextBox>
<dx:ASPxComboBox ID="cmbLocation" runat="server" Width="150px" DataSourceID="queuesXML">
</dx:ASPxComboBox>
<asp:XmlDataSource ID="queuesXML" runat="server" DataFile="~/Config/Config.xml" XPath="queue/name" ></asp:XmlDataSource>
I know I'm using dev express, but that should not matter for this
you need to work on change event of combobox. And Use the selection values as condition.
In a gridview how can I do single radiobutton select without using JavaScript
<asp:TemplateField ShowHeader="False">
<ItemTemplate>
<asp:RadioButton ID="RadioButton1" runat="server" GroupName="GroupName" />
</ItemTemplate>
</asp:TemplateField
Give Different name to each radio button control and remove groupname attribute
e.g.
<asp:RadioButton ID="RadioButton2" runat="server" />
I have a simple dropdownlist.
-I have some columns.
-A column called Choose:
-The control of the column is a dropdownlist with 2 fixed items : Yes and No.
-In the dataTable the column "Choose" the cell has the text "nope";
If debug my webpage , in the gridview,the column that's containing
the dropdownlist is not showing the values from the dataTable . I want the gridview to show them .
So , I want to show the values from the column not from the
dropdownlist
The question is a bit confusing, but it sounds like you want to select the answer from the list. If so, something like this should work:
<ItemTemplate>
<asp:DropDownList ID="DropDownList1" runat="server" SelectedValue='<%# Eval("Answer") %>'>
<asp:ListItem Text="Yes" Value="1" />
<asp:ListItem Text="No" Value="0" />
</asp:DropDownList>
</ItemTemplate>
EDIT: Based on your last comment, it sounds like this is what you need:
<asp:TemplateField>
<ItemTemplate>
<%# Eval("SomeUnrelatedValue") %>
</ItemTemplate>
<EditItemTemplate>
<asp:DropDownList ID="DropDownList1" runat="server">
<asp:ListItem Text="Yes" Value="1" />
<asp:ListItem Text="No" Value="0" />
</asp:DropDownList>
</EditItemTemplate>
</asp:TemplateField>