hi ,
like i have to create a label and that label displays the total cost of a particulat think.like i do some activity A. related to acctivity A are following activities.
A-a
A-b
A-c
A-d

what i hv to do is when user click on the label.it pops up the field and allow the user to add the cost of perfoming each activity a,b,c,d etc.
on adding , if i close that pop up on the label , then that label display the total cost of activities.
can anybody help me ??
what tool this or hw shud i perform this task?

Dani AI

Generated

described the exact UX: click a label, pop up a small editor for A-a/A-b/A-c/A-d, and have the label show the total after the popup closes. pointed to a modal-based approach — that is the right pattern. The simplest, robust flow is: make the label a clickable element (LinkButton or a span with an onclick), present a modal panel containing one input per sub-activity, compute the running total in client script as values change, and on OK copy the computed total into a hidden field and update the visible label. Persist to the server only when the user confirms.

Client-side summing (sketch):

function sumCosts() {
  var ids = ['txtA','txtB','txtC','txtD'];
  var total = 0.0;
  for (var i = 0; i < ids.length; i++) {
    var el = document.getElementById(ids[i]);
    var v = parseFloat((el && el.value) || '0') || 0;
    total += v;
  }
  document.getElementById('lblTotal').innerText = total.toFixed(2);
  document.getElementById('hiddenTotal').value = total;
}

Server-side save handler (sketch):

protected void btnSave_Click(object sender, EventArgs e)
{
  decimal total;
  if (decimal.TryParse(hiddenTotal.Value, out total))
  {
    lblTotal.Text = total.ToString("C");
    // save total and per-item values to DB here
  }
}

Troubleshooting and practical tips: ensure the page registers required scripts if using ASP.NET AJAX; use validators (or client-side checks) to avoid parsing errors; pay attention to culture-specific decimal separators when parsing on the server; use partial postback (UpdatePanel) or an AJAX call to avoid full refresh if desired; watch z-index/styles so the modal stays on top; add keyboard support (Esc to cancel, focus trapping) for accessibility. If the toolkit for VS2008 is not wanted, a lightweight dialog from a JS library (for example jQuery UI) plus the same client-server pattern works equally well.

Recommended Answers

All 3 Replies

you can use a modal popup, show some work and we'll give some further help

actually i hv done some research about it.
the thing is that we hv to use the ajax control kit to use the modal popup .
but i m developing my application in VS 2008. Asp.net , C#. and there is o tool as such of modul popup control.
so hw can i proceed?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.