|
Hi, I have a matrix on RDLC report viewer as following:
C1 C2 Total
Cnt % Cnt % Cnt %
R1 20 30 50
R2 50 50 100
Total 70 80 150
The Subtotal values in column and row are auto-calculated by the matrix object.
How can I access the subtotal value 70, 80, 150 to calculate the % values?
|
|
|
|
|
You can use the group names in totals to calculate.
You could do something like - matrixcoltotal / matrixtotal.
Your expression will look something like this. =Sum(Fields!ReportField.Value,"MatrixGroup")/Sum(Fields!ReportField.Value,"dataset").
Using fields as a real example...
Assuming the name of the column group is WeekStartDate, something like the following should work:
=iif(iif(isnothing(Sum(Fields!RMAs.Value,"WeekStartDate")),0,Sum(Fields!RMAs.Value)/Sum(Fields!RMAs.Value,"WeekStartDate"))=0,nothing,Sum(Fields!RMAs.Value)/Sum(Fields!RMAs.Value,"WeekStartDate"))
|
|
|
|
|
|
I would like to explain my project for you to understand my problem for your support
I am developing a web application asp.net / c # which manages the data center technical inspection of vehicle, what I would like to do is display a list of centers in a gridview and when I double click a row in gridview another page is displayed that contains the information center clicked.
how can I do this??
thank you
|
|
|
|
|
And what part are you having difficulties with? Honestly, there is so much information available from a cursory search on the term gridview you should have no difficulties.
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
the difficulty is in the redirect when I double click on a line, I failed to do that, here is my gridview code click :
protected void GridView1_RowDataBound1(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
e.Row.Attributes["onmouseover"] = "this.style.cursor='hand';this.style.textDecoration='underline';this.style.background='#FFF5E6'";
e.Row.Attributes["onmouseout"] = "this.style.textDecoration='none';this.style.background='none'";
e.Row.Attributes["onclick"] = ClientScript.GetPostBackClientHyperlink(this, "Select$" + e.Row.RowIndex);
}
}
|
|
|
|
|
There is no native double-click event, and in fact, you are only using the click event.
What is happening? Are you not getting the postback at all? Rather than try a posback why not use a hyperlink to the page?
Also, you should use CSS classes rather than hard coding your styles. I'd also investigate JQuery for some of this. You can get almost the same functionality without the weight of the ASP.NET gridview.
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
Checkout this article from Microsoft, it might be a bit of overkill for your first application, but it gives you a starting point. (maybe)
Gridview Master / detail tutorial[^]
|
|
|
|
|
How to get the current theme from within a UserControl ?
|
|
|
|
|
Hi,
you mean like just the Name of the Pages' Theme?
Within your UserControl, use
this.Page.Theme
to get or set the theme.
|
|
|
|
|
Hi,
DeleteImageUrl is an exposed property of the user control.
public string DeleteImageUrl
{
get { return m_strDeleteImageUrl; }
set { m_strDeleteImageUrl = string.Format("~/App_Themes/{0}/{1}", this.Page.Theme, value); }
}
this.Page is null here. Why ?
|
|
|
|
|
Has the UserControl been correctly added to a page before you set that property? When do you access
the property? Is the control dynamically added or in markup?
|
|
|
|
|
I placed the following line in a .skin file.
<UC:MultiFileUpload runat="server" UpperLimit="10" Rows="5" ListItemHoverColor="#F2D76A" DeleteImageUrl="Img/Delete.png" />
|
|
|
|
|
Ah, i see. You're working with skins and want the delete-image-url of your usercontrol to
point to the correct image file of the current theme?
Maybe the answer in
this thread helps you?
|
|
|
|
|
Correct. I followed your link, but I cann't see any answers.
Basically what I do is the following:
On the Page_Load event of the user control I inject javascript.
ScriptManager.RegisterStartupScript(this, typeof(Page), "MultiFileUploadScript", GetJavaScript(), false);
private string GetJavaScript()
{
StringBuilder JavaScript = new StringBuilder();
:
JavaScript.Append("var deleteImage = null;\n");
if (m_strDeleteImageUrl != string.Empty)
{
JavaScript.Append("deleteImage = new Image();\n");
JavaScript.AppendFormat("deleteImage.src = '{0}';\n", m_strDeleteImageUrl);
JavaScript.AppendFormat("deleteImage.setAttribute('alt','{0}');\n", m_strDeleteText);
}
:
return JavaScript.ToString();
}
How can I make m_strDeleteImageUrl point to the correct theme image ?
tia
|
|
|
|
|
Can't you just set the images' filename (or subpath below the themefolder) in the setter
of the DeleteImageUrl property of your usercontrol (without the string.format(..theme...) part)?
Then, in the GetJavaScript() Method (which you call during Page-Load), you can build the correct path including the theme-folder by using Page.Theme, as Page should not be
null there.
|
|
|
|
|
I already tried that. Even in the JavaScript method Page.Theme is null.
Could it have to do the way I set my theme. In web.config I do :
<pages styleSheetTheme="Sunset">
<controls>
:
</controls>
</pages>
tia
|
|
|
|
|
Oh yes, use Page.StyleSheetTheme instead.
I really hope, the Page property of your control is not null..otherwise.. could you provide a sample project where it is not working?
Cheers
|
|
|
|
|
Found it.
In my JavaScript method I got the path as follows :
string strImageThemePath = string.Format("{0}/App_Themes/{1}/{2}", Page.Request.ApplicationPath, Page.StyleSheetTheme, m_strDeleteImageUrl);
Thanks Michael for your help.
|
|
|
|
|
Oh thank god =)
Not a problem - glad it finally worked
|
|
|
|
|
I want to add table rows at run time. when i click '+' button on the 1st row, i want to add the column values (in first row) to a database. similarly 2nd, third and so on respectively.
this is the code
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="admn_div_hist.aspx.cs" Inherits="Portfolio" %><br />
<br />
<br />
<%@ Register Src="Calendar.ascx" TagName="Calendar" TagPrefix="uc1" %><br />
<br />
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><br />
<br />
<html xmlns="http://www.w3.org/1999/xhtml" ><br />
<head runat="server"><br />
<title>Portfolio Management System</title><br />
<script language="javascript" type="text/javascript"><br />
<br />
<br />
function AddRow()<br />
{<br />
var table = document.getElementById("tblGrid");<br />
if (!table) throw "Table not found";<br />
var row = table.insertRow(-1); <br />
<br />
var cell1 = row.insertCell(-1);<br />
var cell2 = row.insertCell(-1);<br />
var cell3 = row.insertCell(-1);<br />
<br />
cell1.innerHTML = "<input type='text' id='div_no'>";<br />
cell2.innerHTML = "<input type='text' id='txt_divdate'> <img src='images/calendar.gif' onclick='caldisplay'>";<br />
cell3.innerHTML = "<input type='text' id='txt_divunits'>";<br />
<br />
<br />
}<br />
<br />
function caldisplay()<br />
{<br />
var dt=document.getElementById('Calendar1');<br />
dt.style.display='block';<br />
<br />
<br />
}<br />
<br />
</script><br />
<br />
<body><br />
<form id="frm_dividend_hist" runat="server"><br />
<table id="tblGrid" style="table-layout:fixed; z-index: 107; left: 125px; position: absolute; top: 216px;" border="1" bordercolor="#3399ff" width="270"><br />
<tr><br />
<td style="height: 19px; width: 70px;"><br />
Dividend #</td><br />
<td style="height: 19px; width: 120px;"><br />
Dividend Date</td><br />
<td style="height: 19px; width: 80px;"><br />
% Units</td><br />
</tr><br />
<tr><br />
<td style="width: 158px; height: 13px"><br />
<asp:TextBox ID="div_no" runat="server" Style="z-index: 100; left: 4px; position: absolute;<br />
top: 29px" Width="57px" Height="13px"></asp:TextBox><br />
</td><br />
<td style="height: 13px; width: 330px;"><br />
<asp:TextBox ID="txt_divdate" runat="server" Style="z-index: 100; left: 80px; position: absolute;<br />
top: 31px" Width="91px" Height="10px"></asp:TextBox><br />
<asp:ImageButton ID="ImageButton2" runat="server" ImageUrl="~/images/calendar.gif"<br />
Style="z-index: 105; left: 182px; position: absolute;<br />
top: 30px" OnClick="ImageButton2_Click1" /><br />
<br />
</td><br />
<td style="width: 50px; height: 19px"><br />
<asp:TextBox ID="txt_divunits" runat="server" Style="z-index: 102;<br />
left: 217px; position: absolute; top: 29px" Width="17px"></asp:TextBox><br />
<asp:Button ID="Button1" runat="server" Style="z-index: 108; left: 250px; position: absolute;<br />
top: 29px" Text="+" Width="27px" OnClick="Button1_Click" Height="20px" /><br />
<br />
</td><br />
</tr><br />
<br />
</table><br />
<br />
</form><br />
</table><br />
<asp:Calendar ID="Calendar1" runat="server" BackColor="White" BorderColor="#999999"<br />
CellPadding="4" DayNameFormat="Shortest" Font-Names="Verdana" Font-Size="8pt"<br />
ForeColor="Black" Height="180px" Style="z-index: 105; left: 674px; position: absolute;<br />
top: 263px" Visible="False" Width="200px" OnSelectionChanged="Calendar1_SelectionChanged"><br />
<SelectedDayStyle BackColor="#666666" Font-Bold="True" ForeColor="White" /><br />
<SelectorStyle BackColor="#CCCCCC" /><br />
<WeekendDayStyle BackColor="#FFFFCC" /><br />
<TodayDayStyle BackColor="#CCCCCC" ForeColor="Black" /><br />
<OtherMonthDayStyle ForeColor="#808080" /><br />
<NextPrevStyle VerticalAlign="Bottom" /><br />
<DayHeaderStyle BackColor="#CCCCCC" Font-Bold="True" Font-Size="7pt" /><br />
<TitleStyle BackColor="#999999" BorderColor="Black" Font-Bold="True" /><br />
</asp:Calendar><br />
</body><br />
</html><br />
Code Behind page
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data.SqlClient;
using Logic;
public partial class Portfolio : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void ImageButton2_Click1(object sender, ImageClickEventArgs e)
{
Calendar1.Visible = true;
}
protected void Calendar1_SelectionChanged(object sender, EventArgs e)
{
this.txt_divdate.Text = Calendar1.SelectedDate.ToString("d");
Calendar1.Visible = false;
}
protected void Button1_Click(object sender, EventArgs e)
{
this.Button1.Attributes.Add("onclick", "AddRow()");
}
}
|
|
|
|
|
I don't think this approach will work. If I were you I'd look at handling the add row event on the server side using a GridView.
|
|
|
|
|
pl help me in solving this using gridview
|
|
|
|
|
|
You were close to getting it right.I made some minor
changes to make it work. Consider this code ...
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head id="Head1" runat="server">
<title>Portfolio Management System</title>
<script language="javascript" type="text/javascript">
function AddRow()
{
var table = document.getElementById("tblGrid");
if (!table) throw "Table not found";
var row = table.insertRow(-1);
var cell1 = row.insertCell(-1);
var cell2 = row.insertCell(-1);
var cell3 = row.insertCell(-1);
cell1.innerHTML = "<input type='text' id='div_no'>";
cell2.innerHTML = "<input type='text' id='txt_divdate'> <img src='images/calendar.gif' onclick='caldisplay'>";
cell3.innerHTML = "<input type='text' id='txt_divunits'>";
}
function caldisplay()
{
}
</script> </head>
<body>
<form id="frm_dividend_hist" runat="server">
<table id="tblGrid" style="table-layout:fixed; z-index: 107; left: 125px; position: absolute; top: 216px;" border="1" bordercolor="#3399ff" width="270">
<tr>
<td style="height: 19px; width: 70px;">
Dividend #
</td>
<td style="height: 19px; width: 120px;">
Dividend Date
</td>
<td style="height: 19px; width: 80px;">
% Units
</td>
</tr>
<tr>
<td style="width: 158px; height: 13px">
<asp:TextBox ID="div_no" runat="server" Style="z-index: 100; left: 4px; position: absolute;
top: 29px" Width="57px" Height="13px">
</asp:TextBox>
</td>
<td style="height: 13px; width: 330px;">
<asp:TextBox ID="txt_divdate" runat="server" Style="z-index: 100; left: 80px; position: absolute;
top: 31px" Width="91px" Height="10px">
</asp:TextBox>
<asp:ImageButton ID="ImageButton2" runat="server" ImageUrl="~/images/calendar.gif" Style="z-index: 105; left: 182px; position: absolute;
top: 30px" OnClick="ImageButton2_Click1" />
</td>
<td style="width: 50px; height: 19px">
<asp:TextBox ID="txt_divunits" runat="server" Style="z-index: 102;
left: 217px; position: absolute; top: 29px" Width="17px">
</asp:TextBox>
<input type="button" ID="Button1" Style="z-index: 108; left: 250px; position: absolute;
top: 29px" Text="+" Width="27px" OnClick="AddRow()" Height="20px" />
</td>
</tr>
</table>
</form> </table> <asp:Calendar ID="Calendar1" runat="server" BackColor="White" BorderColor="#999999" CellPadding="4" DayNameFormat="Shortest" Font-Names="Verdana" Font-Size="8pt" ForeColor="Black" Height="180px" Style="z-index: 105; left: 674px; position: absolute;
top: 263px" Visible="False" Width="200px" OnSelectionChanged="Calendar1_SelectionChanged"> <SelectedDayStyle BackColor="#666666" Font-Bold="True" ForeColor="White" /> <SelectorStyle BackColor="#CCCCCC" /> <WeekendDayStyle BackColor="#FFFFCC" /> <TodayDayStyle BackColor="#CCCCCC" ForeColor="Black" /> <OtherMonthDayStyle ForeColor="#808080" /> <NextPrevStyle VerticalAlign="Bottom" /> <DayHeaderStyle BackColor="#CCCCCC" Font-Bold="True" Font-Size="7pt" /> <TitleStyle BackColor="#999999" BorderColor="Black" Font-Bold="True" /> </asp:Calendar> </body> </html>
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data.SqlClient;
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void ImageButton2_Click1(object sender, ImageClickEventArgs e)
{
Calendar1.Visible = true;
}
protected void Calendar1_SelectionChanged(object sender, EventArgs e)
{
this.txt_divdate.Text = Calendar1.SelectedDate.ToString("d");
Calendar1.Visible = false;
}
}
|
|
|
|