hiii
i have some problem.
How to count total value from dropdownlist and show in gridview footer.
when value change in dropdownlist the total count will show in footer.
Loading
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
ranjan sahooRank #5,709 · 289 reputationPosted Sep 27, 2013, 12:06 AM EDT
ranjan sahooRank #5,709 · 289 reputationPosted Sep 27, 2013, 12:52 AM EDT
Sanjeeb LenkaRank #301 · 8.3K reputationPosted Sep 27, 2013, 12:54 AM EDT
can you provide more clear details of your requirement.
Sanjay KumarRank #561 · 4.3K reputationPosted Sep 27, 2013, 12:56 AM EDT
http://msdn.microsoft.com/en-us/library/bb310552.aspx
http://www.asp.net/web-forms/tutorials/data-access/custom-formatting/displaying-summary-information-in-the-gridview-s-footer-cs
Sanjay KumarRank #561 · 4.3K reputationPosted Sep 27, 2013, 1:03 AM EDT
try link
http://www.aspmemo.net/2012/04/how-to-edit-gridview-row-data-in-client.html
http://weblogs.asp.net/ashrafurrahaman/archive/2009/02/26/javascript-for-gridview-row-level.aspx
ranjan sahooRank #5,709 · 289 reputationPosted Sep 27, 2013, 1:11 AM EDT
ranjan sahooRank #5,709 · 289 reputationPosted Sep 27, 2013, 1:16 AM EDT
ranjan sahooRank #5,709 · 289 reputationPosted Sep 27, 2013, 1:23 AM EDT
ranjan sahooRank #5,709 · 289 reputationPosted Sep 27, 2013, 1:23 AM EDT
ranjan sahooRank #5,709 · 289 reputationPosted Sep 27, 2013, 1:37 AM EDT
ranjan sahooRank #5,709 · 289 reputationPosted Sep 27, 2013, 1:52 AM EDT
Sanjeeb LenkaRank #301 · 8.3K reputationPosted Sep 27, 2013, 2:15 AM EDT
http://stackoverflow.com/questions/11734308/displaying-total-in-footer-of-gridview-and-also-add-sum-of-columnsrow-vise-in
ranjan sahooRank #5,709 · 289 reputationPosted Sep 27, 2013, 2:26 AM EDT
Sanjay KumarRank #561 · 4.3K reputationPosted Sep 27, 2013, 2:28 AM EDT
http://www.webcodeexpert.com/2013/08/how-to-get-dropdownlist-selected-value.html#.UkVefNIyaaY
ranjan sahooRank #5,709 · 289 reputationPosted Sep 27, 2013, 2:33 AM EDT
ranjan sahooRank #5,709 · 289 reputationPosted Sep 27, 2013, 2:35 AM EDT
Sanjay KumarRank #561 · 4.3K reputationPosted Sep 27, 2013, 2:37 AM EDT
http://www.aspmemo.net/2012/04/how-to-edit-gridview-row-data-in-client.html
ranjan sahooRank #5,709 · 289 reputationPosted Sep 27, 2013, 2:39 AM EDT
ranjan sahooRank #5,709 · 289 reputationPosted Sep 27, 2013, 2:39 AM EDT
ranjan sahooRank #5,709 · 289 reputationPosted Sep 27, 2013, 2:41 AM EDT
Sanjeeb LenkaRank #301 · 8.3K reputationPosted Sep 27, 2013, 3:04 AM EDT
ranjan sahooRank #5,709 · 289 reputationPosted Sep 27, 2013, 9:24 AM EDT
ranjan sahooRank #5,709 · 289 reputationPosted Sep 27, 2013, 11:10 PM EDT
Deepak VermaRank #672 · 3.6K reputationPosted Oct 16, 2013, 2:16 AM EDT
here is a simple demo which solves your problem. This demo uses jquery approach.
Code Behind:
using System;
using System.Collections.Generic;
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
List<Number> list = new List<Number>();
list.Add(new Number("1"));
list.Add(new Number("2"));
list.Add(new Number("3"));
list.Add(new Number("4"));
GridView1.DataSource = list;
GridView1.DataBind();
}
public class Number
{
public string Num { get; set; }
public Number(string str)
{
this.Num = str;
}
}
}
ASPX
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="false">
<Columns>
<asp:TemplateField HeaderText="Serial Number">
<ItemTemplate>
<%# ((Number)Container.DataItem).Num %>
ItemTemplate>
asp:TemplateField>
<asp:TemplateField HeaderText="Values">
<ItemTemplate>
<asp:DropDownList ID="DropDownList1" runat="server" ClientIDMode="Static" CssClass="items">
<asp:ListItem>1asp:ListItem>
<asp:ListItem>2asp:ListItem>
<asp:ListItem>3asp:ListItem>
<asp:ListItem>4asp:ListItem>
asp:DropDownList>
ItemTemplate>
asp:TemplateField>
Columns>
asp:GridView>
<br />
Total : <asp:Label ID="LabelTotal" runat="server" ClientIDMode="Static">asp:Label>
<script>
$(document).ready(function () {
CalculateTotal();
$('.items').change(function () { CalculateTotal(); });
});
function CalculateTotal() {
var val = 0;
$('.items').each(function () {
val = val + parseFloat($(this).find('option:selected').val());
});
$('#LabelTotal').text(val);
val = 0;
}
script>
Cheers!
ranjan sahooRank #5,709 · 289 reputationPosted Oct 16, 2013, 2:42 AM EDT
your concept is right . but the result is not showing
Deepak VermaRank #672 · 3.6K reputationPosted Oct 16, 2013, 3:02 AM EDT