Showing posts with label button. Show all posts
Showing posts with label button. Show all posts

Monday, March 19, 2012

collapse button in SQL reports

I am working with SQL reporting services, I am getting the data dispalyed...

the only problem is that I am not able to collapse, ie (+) button next to the row header and the cloum header.

Can any one let me know, how to get that....

Thnks in adv.

Hi,

i don′t know how familiar you are with Reporting Services, but this is the function accessible through the Hidden property. Select e.g. a group in your table (clicking on the row left next to the table) and choose the property Hidden = True, then specify a toggle item (up the hierarchy of the group could be a textbox in the table) which should display the +/- signs:

http://www.simple-talk.com/sql/learn-sql-server/beginning-sql-server-2005-reporting-services-part-2/


Jens K. Suessmeyer.

http://www.sqlserver2005.de

Collapse All Groups

Does anyone know how to create a button or link that would collapse all open
groups? I'd like a link/button that would collapse all lower level items.
For example if your report looks like this:
Level 1
Level 2
Level 3
And the user has it drilleddown all the way, they could click the button and
it would collapse so it only showed Level1. Any ideas?
DerekUnfortunately, this feature is not currently supported. If the default
state of the report was only Level 1 shown, they could always refresh.
--
This posting is provided "AS IS" with no warranties, and confers no rights.
"Derek Fisher" <DerekFisher@.discussions.microsoft.com> wrote in message
news:44918CD9-0D33-4F6B-B301-88C2CCCBB08C@.microsoft.com...
> Does anyone know how to create a button or link that would collapse all
> open
> groups? I'd like a link/button that would collapse all lower level items.
> For example if your report looks like this:
> Level 1
> Level 2
> Level 3
> And the user has it drilleddown all the way, they could click the button
> and
> it would collapse so it only showed Level1. Any ideas?
> Derek|||Thanks. I just wanted to see if there was some way to do this.
"Donovan Smith [MSFT]" wrote:
> Unfortunately, this feature is not currently supported. If the default
> state of the report was only Level 1 shown, they could always refresh.
> --
> This posting is provided "AS IS" with no warranties, and confers no rights.
>
> "Derek Fisher" <DerekFisher@.discussions.microsoft.com> wrote in message
> news:44918CD9-0D33-4F6B-B301-88C2CCCBB08C@.microsoft.com...
> > Does anyone know how to create a button or link that would collapse all
> > open
> > groups? I'd like a link/button that would collapse all lower level items.
> > For example if your report looks like this:
> > Level 1
> > Level 2
> > Level 3
> > And the user has it drilleddown all the way, they could click the button
> > and
> > it would collapse so it only showed Level1. Any ideas?
> >
> > Derek
>
>

Thursday, March 8, 2012

Code error please help

my code was working fine but i changed a few things and now i cant figure it out.

the problem is that when i click my edit button none of the items go into the listbox. i added a label to track th error and i narrowed it done to a smaller ssection. Please help

//------------------------ /////////////////////////////////////////////////////////////////////////////////protected void EditButton1_Click(object sender, EventArgs e) {int counter = 0;//counter for inserting into arraybool Validate = checknumberValidation(TextBox1.Text.ToString());if (Validate ==false)throw new Exception(InvalidCheckNumber + TextBox1.Text); Label4.Text = GridView1.Rows.Count.ToString();//---RETURNS 0--SHOULD BE NUMBER OF ITEMS--// //get # of checkboxes and set array size;int x = 0; x = SetStringArraySize();//set x to number of checkboxes that are checked String[] updateString =new String[x];//create string array of size x Label4.Text = GridView1.Rows.Count.ToString();//---RETURNS 0--SHOULD BE NUMBER OF ITEMS--// //for loop that will insert update statements into arrayfor (int i = 0; i < GridView1.Rows.Count; i++) { GridViewRow row = GridView1.Rows[i];bool isChecked = ((CheckBox)row.FindControl("UpdateCheckBox1")).Checked;if (isChecked ==true) {if (counter == 0) updateString[counter] ="[batchid] = '" + GridView1.Rows[i].Cells[3].Text +"' AND [loanid] = '" + GridView1.Rows[i].Cells[5].Text +"' AND [historycounter]='" + GridView1.Rows[i].Cells[8].Text +"'";if (counter > 0) updateString[counter] ="[batchid] = '" + GridView1.Rows[i].Cells[3].Text +"' AND [loanid] = '" + GridView1.Rows[i].Cells[5].Text +"' AND [historycounter]='" + GridView1.Rows[i].Cells[8].Text +"'"; counter++; } }//Add items to listbox and set listbox to visible. Panel1.Visible =true; PanelGridView.Visible =false; Panel2.Visible =false; updateCount.Text = updateString.Length.ToString(); updateCheckNumber.Text = TextBox1.Text;int q = 0;while (q < updateString.Length) { ListBox1.Items.Add(updateString[q]); q++; }//Label1.Text = temp.Length.ToString(); //Test print to label }//------------------------ //COMPLETEprotected int SetStringArraySize() { Label4.Text = GridView1.Rows.Count.ToString();//---RETURNS 0--SHOULD BE NUMBER OF ITEMS--//int count = 0;for (int i = 0; i < GridView1.Rows.Count; i++) { GridViewRow row = GridView1.Rows[i];bool isChecked = ((CheckBox)row.FindControl("UpdateCheckBox1")).Checked;if (isChecked ==true) { count++; } } Label4.Text = GridView1.Rows.Count.ToString();//---RETURNS 0--SHOULD BE NUMBER OF ITEMS--//return count;//returns number of checkboxes that are checked }///////////////////////////////////////////////////////////////////////////////// //------------------------
Are you saying GridView1 has no rows at time of clicking button? Have you checked it's Databound? Try adding a Gridview1.DataBind() statement before accessing the Rows.Count property.|||

ill give that a try.

I added a e.rowsaffected on the pageload for a count and it returns the correct number in the gridview on the page load. Then when i click my edit button it still says the number of rows but the other label still says 0. Ill try what you said, hopefully that works

|||

ok the label now returns the correct count but i have narrowed down the problem to my function that checks for the check boxes.

protected int SetStringArraySize() { Label4.Text = GridView1.Rows.Count.ToString();int count = 0;for (int i = 0; i < GridView1.Rows.Count; i++) { GridViewRow row = GridView1.Rows[i];bool isChecked = ((CheckBox)row.FindControl("UpdateCheckBox1")).Checked;if (isChecked ==true) { count++; } }return count;//returns number of checkboxes that are checked }

This always returns 0. my guess is it is not finding the control "UpdateCheckBox1" so here is the html code to go with it where i specify the check box and it shows up and is functional.

<%@. Page Language="C#" MasterPageFile="~/MasterPage2.master" AutoEventWireup="true" CodeFile="checknum.aspx.cs" Inherits="checknum" Title="Intranet - Utilities - Check Number Assignment" %><%@. Register Assembly="eWorld.UI, Version=2.0.0.2148, Culture=neutral, PublicKeyToken=24d65337282035f2" Namespace="eWorld.UI" TagPrefix="ew" %><asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server"><!-- Auto Refresh page after 16 Minutes (1000 seconds) <meta http-equiv="refresh" content="1000"; url="checknum.aspx" />--> <script type="text/javascript" language="javascript"> function SelectAllCheckboxes(spanChk) { // Added as ASPX uses SPAN for checkbox var oItem = spanChk.children; var theBox=(spanChk.type=="checkbox")?spanChk:spanChk.children.item[0]; xState=theBox.checked; elm=theBox.form.elements; for(i=0;i<elm.length;i++) { if(elm[i].type=="checkbox" && elm[i].id!=theBox.id) { //elm[i].click(); if(elm[i].checked!=xState) elm[i].click(); //elm[i].checked=xState; } } }//end function function fnCheckTextBox1(sender, args) { var TextBox1 = document.getElementById("SearchTextBox1"); var TextBox2 = document.getElementById("SearchTextBox2"); if (TextBox1.value == '') { TextBox2.value = ''; TextBox2.disabled = true } else { TextBox2.disabled = false; } args.IsValid = true; } div><table style="width: 100%; font-size: 11pt"><tr style="width: 100%"><td style="width: 100%; text-align: center; background-color:#5D7B9D"> <strong><span style="color: white">Check Number Assignment</span></strong></td></tr></table></div> <div> <table style="font-size: 10pt; width: 100%"> <tr> <td align="right" style="width: 118px" valign="middle"> <span style="font-size: 10pt">PayeeID:</span></td> <td style="width: 20%" valign="middle"> <ew:MaskedTextBox ID="SearchTextBox1" runat="server" Font-Size="10pt"> </ew:MaskedTextBox></td> <td style="width: 20%" valign="bottom"> <asp:Button ID="SearchButton1" runat="server" Font-Size="10pt" Text="Search" OnClick="SearchButton1_Click" /> <asp:Button ID="resetButton" runat="server" Font-Size="10pt" OnClick="resetButton_Click" Text="Reset" /></td> <td rowspan="3" style="width: 48%"> <span style="font-size: 9pt">When searching by PayeeID use % as a wildcard. <br /> Example to search for all payees that have 'abc' in their PayeeID you would type %abc%<br /> <br /> Enter TransactionDate as mmddyy<br /> <br /> <asp:Label ID="Label2" runat="server" Text="Label" ForeColor="#FF0000"></asp:Label> <br /> <asp:Label ID="Label3" runat="server" ForeColor="#FF0000"></asp:Label> <br /> <asp:Label ID="itemCount" runat="server" Text="Label" ForeColor="Green"></asp:Label></span></td> </tr> <tr> <td align="right" style="width: 118px; height: 32px;" valign="middle"> <span style="font-size: 10pt">BatchID:</span></td> <td style="width: 20%; height: 32px;" valign="middle"> <ew:MaskedTextBox ID="SearchTextBox2" runat="server" Font-Size="10pt"> </ew:MaskedTextBox></td> <td style="width: 20%; height: 32px;"> </td> </tr> <tr> <td align="right" style="width: 118px; height: 34px;" valign="middle"> <span style="font-size: 10pt">TransactionDate:</span></td> <td style="width: 20%; height: 34px;" valign="middle"> <ew:MaskedTextBox ID="searchTransDate" Mask="99/99/99" ValidationExpression="^\d{2}/\d{2}/\d{2}$" runat="server"></ew:MaskedTextBox></td> <td style="width: 20%; height: 34px; text-align: center;"> <asp:Label ID="Label4" runat="server" Text="Label"></asp:Label></td> </tr> </table> <asp:Panel ID="Panel3" runat="server" Height="52px" Visible="False" Width="100%"> <hr style="height: 1px" />  <br /> <asp:Label ID="Label1" runat="server" Text="Label" Font-Size="10pt"></asp:Label><br /> <span style="font-size: 10pt"><strong>To change more check #s please click reset!<br /> </strong></span> </asp:Panel> <asp:Panel ID="Panel1" runat="server" Height="50px" Visible="False" Width="100%"> <span style="font-size: 10pt">You are about to change the check number on the following <asp:Label ID="updateCount" runat="server" Text="Label"></asp:Label> items to Check# <asp:Label ID="updateCheckNumber" runat="server" Text="Label"></asp:Label>.<br /> </span> <asp:Button ID="updateConfirm" runat="server" Font-Size="10pt" OnClick="updateConfirm_Click" Text="Confirm" />       <asp:Button ID="updateCancel" runat="server" Font-Size="10pt" OnClick="updateCancel_Click" Text="Cancel" /><br /> <br /> <br /> <asp:ListBox ID="ListBox1" runat="server" Font-Size="8pt" Height="172px" Width="100%"> </asp:ListBox></asp:Panel> <br /> <asp:Panel ID="Panel2" runat="server" Height="34px" Width="100%"> <asp:Button ID="EditButton1" runat="server" Text="Update" Width="72px" OnClick="EditButton1_Click" Font-Size="10pt" Height="24px" /> <span style="font-size: 10pt">Check #: <asp:TextBox ID="TextBox1" runat="server" Width="160px" Font-Size="10pt"></asp:TextBox></span></asp:Panel> <asp:Panel ID="PanelGridView" runat="server" Height="500px" ScrollBars="Auto" Width="100%"> <br /> <asp:GridView ID="GridView1" runat="server" AllowSorting="True" AutoGenerateColumns="False" CellPadding="4" DataSourceID="SqlDataSource1" ForeColor="#333333" GridLines="None" Font-Names="Verdana" Font-Size="10pt" PageSize="20" EnableViewState="False"> <FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" /> <Columns> <asp:TemplateField> <ItemTemplate> <asp:CheckBox ID="Update_CheckBox1" runat="server" /> </ItemTemplate> <HeaderTemplate> <input id="Update_CheckBox1" onclick="javascript:SelectAllCheckboxes(this);" runat="server" type="checkbox" /> </HeaderTemplate> </asp:TemplateField> <asp:BoundField DataField="TransactionDate" HeaderText="Posting Date" SortExpression="TransactionDate" DataFormatString="{0:MM/dd/yyyy}" HtmlEncode="False" ReadOnly="True" /> <asp:BoundField DataField="CheckNumber" HeaderText="Check #" SortExpression="CheckNumber" ReadOnly="True"> <ItemStyle HorizontalAlign="Center" /> </asp:BoundField> <asp:BoundField DataField="BatchID" HeaderText="BatchID" SortExpression="BatchID" ReadOnly="True" /> <asp:BoundField DataField="PayeeID" HeaderText="PayeeID" SortExpression="PayeeID" ReadOnly="True" /> <asp:BoundField DataField="LoanID" HeaderText="LoanID" SortExpression="LoanID" ReadOnly="True" /> <asp:BoundField DataField="TransactionAmt" HeaderText="Transaction Amount" SortExpression="TransactionAmt" ReadOnly="True" DataFormatString="{0:f2}" HtmlEncode="False"> <ItemStyle HorizontalAlign="Right" /> </asp:BoundField> <asp:BoundField DataField="FeeDesc" HeaderText="Fee Description" SortExpression="FeeDesc" ReadOnly="True" /> <asp:BoundField DataField="HistoryCounter" HeaderText=" " SortExpression="HistoryCounter" ReadOnly="True"> <ItemStyle CssClass="hiddencol" /> </asp:BoundField> </Columns> <RowStyle BackColor="#F7F6F3" ForeColor="#333333" /> <EditRowStyle BackColor="#999999" /> <SelectedRowStyle BackColor="#E2DED6" Font-Bold="True" ForeColor="#333333" /> <PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center" /> <HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" /> <AlternatingRowStyle BackColor="White" ForeColor="#284775" /> </asp:GridView> <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="
|||

<asp:TemplateField>
<ItemTemplate>
<asp:CheckBox ID="Update_CheckBox1" runat="server" />
</ItemTemplate>
<HeaderTemplate>
<input id="Update_CheckBox1" onclick="javascript:SelectAllCheckboxes(this);" runat="server"
type="checkbox" />
</HeaderTemplate>
</asp:TemplateField>
==========================================================

is actually correct below. I just tried changing the name to see if that was it.

==========================================================

<asp:TemplateField>
<ItemTemplate>
<asp:CheckBox ID="UpdateCheckBox1" runat="server" />
</ItemTemplate>
<HeaderTemplate>
<input id="UpdateCheckBox1" onclick="javascript:SelectAllCheckboxes(this);" runat="server"
type="checkbox" />
</HeaderTemplate>
</asp:TemplateField>
==========================================================