dpreznik 0 Light Poster

Dear experts,

In my application, I am using a custom control that is a GroupBox and a CheckBox instead of a common caption. I got the control here:
http://www.codeguru.com/cpp/cpp/cpp_mfc/article.php/c4149
I had to change the code to allow the checkbox to have multiline text:

CRect rc;
      GetWindowRect(rc);      // Get the rect of the GroupBox
      this->ScreenToClient(rc);
// Change rc to be used for the checkbox
      rc.left += 5;
      rc.right = min(rc.left + czText.cx, rc.right - 5);
      
      int iGroupBoxWidth = rc.right - rc.left;
      double iLinesCount = ceil((double)czText.cx / iGroupBoxWidth);
      rc.top -= (long)((iLinesCount - 1) * czText.cy / 2);
      rc.bottom = (long)(rc.top + czText.cy * iLinesCount);

      if(style == BS_AUTOCHECKBOX)
      {
            m_TitleBox.Create(strText, BS_AUTOCHECKBOX | BS_MULTILINE | WS_CHILD  | WS_TABSTOP, rc, this, ID_TITLE);
      }

As you can see, I change rc.top to have the middle of the checkbox neatly on the same level as the top edge of the groupbox, as in case of single-line caption. The multiline caption should be spread equally over and under that level. I can see that the checkbox is in the right place, so the top of the caption is calculated correctly, but the upper part of the caption text is cut off. I can see the caption not higher than the upper edge of the checkbox. Could you please tell me why this happens?

Thanks.
Here I attached an image to show how it looks.

dpreznik 0 Light Poster

Dear experts,

Could you please tell me if it is possible to have a multiline caption for a Group Box? I have a GroupBox that uses a checkbox as a title. The style of the checkbox is set like this:

m_TitleBox.Create(strText, BS_AUTOCHECKBOX | WS_CHILD  | WS_TABSTOP, rc, this, ID_TITLE);

I tried to add BS_MULTILINE:

m_TitleBox.Create(strText, BS_AUTOCHECKBOX | BS_MULTILINE | WS_CHILD  | WS_TABSTOP, rc, this, ID_TITLE);

But it doesn't help.

Thanks.

dpreznik 0 Light Poster
<asp:Button ID="btnSubmitOffer" runat="server" Text="Submit Offer" 
        Width="100px" onclick="btnSubmitOffer_Click" />  
...
    <asp:Button ID="btnShowSubmitOfferPopup" runat="server" style="display:none" />
...
    <asp:Panel ID="pnlSubmitOffer" runat="server" CssClass="modalPopup" Style="display:none" Width="700px" >
        <asp:GridView ID="SubmitOfferGridView" runat="server" AllowSorting="True"
                AutoGenerateColumns="False" 
                Width="100%" Height="306px" DataKeyNames="EAN" >
            <AlternatingRowStyle CssClass="alternatingrowstyle" />
            <Columns>
                <asp:BoundField DataField="EAN" HeaderText="EAN" SortExpression="EAN" />
                <asp:TemplateField HeaderText="Offer Date" SortExpression="OfferDate">
                    <ItemTemplate>   
                        <asp:ImageButton runat="Server" ID="imgBtnOfferDate" 
                            ImageUrl="~/Images/Calendar_scheduleHS.png" 
                            AlternateText="Click here to display calendar" />
                        <asp:TextBox ID="OfferDate" runat="server" 
                            Text='<%# Bind("OfferDate","{0:M/d/yyyy}") %>'></asp:TextBox>
                        <ajaxToolkit:CalendarExtender ID="OfferDateCE" runat="server" 
                            TargetControlID="OfferDate" PopupButtonID="imgBtnOfferDate"/>                                
                        <asp:CompareValidator ID="OfferDateCompareValidator" runat="server" 
                            ControlToValidate="OfferDate" Display="Dynamic" 
                            ErrorMessage="Invalid OfferDate!" Text="*" Operator="DataTypeCheck" 
                            Type="Date"></asp:CompareValidator>
                        <ajaxToolkit:ValidatorCalloutExtender ID="OfferDateCompareValidator_ValidatorCalloutExtender" 
                            runat="server" Enabled="True" TargetControlID="OfferDateCompareValidator"></ajaxToolkit:ValidatorCalloutExtender>
                    </ItemTemplate>
                </asp:TemplateField>   
                <asp:TemplateField HeaderText="Amount" SortExpression="Amount">
                    <ItemTemplate>    
                        <asp:TextBox ID="Amount" runat="server" Text='<%#Bind("Amount") %>'></asp:TextBox>
                        <asp:CompareValidator ID="AmountCompareValidator" runat="server" 
                            ControlToValidate="Amount" Display="Dynamic" 
                            ErrorMessage="Amount has invalid currency value!" Text="*" 
                            Operator="DataTypeCheck" Type="Currency"></asp:CompareValidator>
                    </ItemTemplate>
                </asp:TemplateField>    
                <asp:TemplateField HeaderText="Expiration Date" SortExpression="ExpirationDate">
                    <ItemTemplate>   
                        <asp:ImageButton runat="Server" ID="imgBtnExpirationDate" 
                            ImageUrl="~/Images/Calendar_scheduleHS.png" 
                            AlternateText="Click here to display calendar" />
                        <asp:TextBox ID="ExpirationDate" runat="server" 
                            Text='<%# Bind("ExpirationDate","{0:M/d/yyyy}") %>'></asp:TextBox>
                        <ajaxToolkit:CalendarExtender ID="ExpirationDateCE" runat="server" 
                            TargetControlID="ExpirationDate" PopupButtonID="imgBtnExpirationDate"/>                                
                        <asp:CompareValidator ID="ExpirationDateCompareValidator" runat="server" 
                            ControlToValidate="ExpirationDate" Display="Dynamic" 
                            ErrorMessage="Invalid ExpirationDate!" Text="*" Operator="DataTypeCheck" 
                            Type="Date"></asp:CompareValidator>
                        <ajaxToolkit:ValidatorCalloutExtender ID="ExpirationDateCompareValidator_ValidatorCalloutExtender" 
                            runat="server" Enabled="True" 
                            TargetControlID="ExpirationDateCompareValidator"></ajaxToolkit:ValidatorCalloutExtender>
                    </ItemTemplate>
                </asp:TemplateField>                                                  
            </Columns>
            <HeaderStyle CssClass="headerstyle" />
        </asp:GridView> 

        <div align="center">
            <asp:Button ID="btnSubmitSubmitOffer" runat="server" Text="Submit" OnClick="btnSubmitSubmitOffer_Click" />
            <asp:Button ID="btnCancelSubmitOffer" runat="server" Text="Cancel" />
        </div>
    </asp:Panel>

    protected void btnSubmitOffer_Click(object sender, EventArgs e)
    {
        RememberOldValues();    // Store in Session keys of the checked rows on the current page

        var keys = Session["CHECKED_ITEMS"] as Dictionary<string, Offer>;

        if (keys == null || keys.Count == 0)
        {
            SetWarningLabel("You did not select any records.");
            return;
        }

        DataTable submitOfferTable = new DataTable();
        DataColumn columnEAN = new DataColumn("EAN", Type.GetType("System.String"));
        columnEAN.Unique = true;
        submitOfferTable.Columns.Add(columnEAN);
        DataColumn columnOfferDate = new DataColumn("OfferDate", Type.GetType("System.DateTime"));
        submitOfferTable.Columns.Add(columnOfferDate);
        DataColumn columnAmount = new DataColumn("Amount", Type.GetType("System.Double"));
        submitOfferTable.Columns.Add(columnAmount);
        DataColumn columnExpirationDate = new DataColumn("ExpirationDate", Type.GetType("System.DateTime")); …
dpreznik 0 Light Poster

Dear Experts,

I have a modal popup and a GridView in it. The GridView is populated programmatically, i.e. I use .DataBind(). I can enter data into some of the GridView's controls. After I press Submit, I expect to do something with the entered data. But in the button press handler, the GridView is empty. The data entered e.g. into a TextBox is preserved, it is only GridView that has this problem. I din't set EnableViewState of the page or of the GridView to false, moreover, I explicitly set it to true.
Maybe somebody could help me on this?

Thanks,
Dmitriy

dpreznik 0 Light Poster

Dear experts,

I have a TabContainer, and one of its tab panels has a user control with a wide GridView in it. Because of some reason, the GridView goes way beyond the size of the tab panel and the tab container. How can I make the form and the tab panel expand based on the width of the GridView?
I don't want the scroll bar to appear in the tab container, but I want the container to expand to fit the GridView. I need a scroll bar in the browser window.

Thank you very much.

dpreznik 0 Light Poster

Actually, I can. When I debug in Firebug, I can see that the code is executed. E.g. I can show alert(), if I place it instead of button click. Moreover, it works in IE. I have a problem only in Firefox.

dpreznik 0 Light Poster

Dear experts,

I have a GridView with an invisible CancelEdit button. I want to use this button to get out of Edit mode. When I make this button visible for testing purposes and press it with the mouse, it works fine, getting me out of Edit mode. But I need to get out of Edit mode on pressing Esc key. I use a javascript function for this. But though the CancelEdit button is found, .click() doesn't do anything, and I still in Edit mode. Could you help me on this, please? Here is my code:

function keyPressHandler(e) {
            var kC = (window.event) ?    // MSIE or Firefox?
                 event.keyCode : e.keyCode;
            var Esc = (window.event) ?
                27 : e.DOM_VK_ESCAPE;    // MSIE or Firefox
            if (kC == Esc) {
                try {
                    document.getElementById('<%=((FrontListGridView.EditIndex > -1)?(FrontListGridView.Rows[FrontListGridView.EditIndex].Cells[1].FindControl("CancelEdit").ClientID):string.Empty) %>').click();
                }
                catch (e) {
                    alert(e.message);
                } 
            }
        }

...

                     <asp:TemplateField>  
                        <EditItemTemplate>  
                            <asp:Button ID="CancelEdit" runat="server" CommandName="Cancel" />  
                        </EditItemTemplate>  
                     </asp:TemplateField>
...
In Page_Load():
Page.ClientScript.RegisterStartupScript(typeof(Page), "escscript", "document.onkeypress=keyPressHandler;", true);
dpreznik 0 Light Poster

That is really strange, and I cannot explain it. I removed the Update Panel and provided lazy loading by using TabChange event handler to make visible only GridView in the currently active tab.
Thank you for your help.

dpreznik 0 Light Poster

It worked when I removed UpdatePanels... I would prefer to keep them for better performance, but what can I do...

dpreznik 0 Light Poster

Ossehaas,
Thank you for your answer.
Unfortunately, that didn't help.
I wonder why it works after refreshing.
I cannot use Bind there, because the field should be a dropdown list.
All that used to work before I added UpdatePanels inside aeach tab panel around its contents.

dpreznik 0 Light Poster

Dear friends,

I have a tab container with many tab panels in it. In each tab panel, I have a GridView which has an Edit button in each row. When Edit button is pressed, it turns into an Update button, and all fields become editable. When the Update button is pressed, the values are saved in the database.
I have 2 problems:
1) On pressing the Edit button, sometimes nothing happens, sometimes it works properly.
I noticed that Edit always works if I first refresh the page.
When the Edit button works on one tab panel, and I change tab, on another tab panel it doesn't work, the Edit button handler is not called, and when I press Edit, the TabChanged handler is called instead.
2) On pressing Update button, DBInterfaceGridView_RowUpdating() is not executed, thus nothing is saved.

<ajaxToolkit:TabContainer ID="tcDBInterface" runat="server" 
    ActiveTabIndex="16" OnClientActiveTabChanged="clientActiveTabChanged" 
    Width="5100" style="margin-right: 53px" 
    onactivetabchanged="tcDBInterface_ActiveTabChanged" > 
        <ajaxToolkit:TabPanel runat="server" HeaderText="AuthourLinks" ID="AuthorLinksTabPanel" >
            <HeaderTemplate>
                AuthourLinks
            </HeaderTemplate>
            <ContentTemplate>     
             
                <asp:UpdatePanel ID="upnlAuthorLinks" runat="server" UpdateMode="Conditional">
                    <ContentTemplate>                  
               
                    <asp:ValidationSummary ID="AuthorLinksValidationSummary" runat="server" 
                        BorderStyle="Solid" HeaderText="The following error(s) occured:" />      

                    <asp:GridView ID="AuthorLinksGridView" runat="server" AllowSorting="True" ShowFooter="True"
                            AllowPaging="True" PageSize="15" DataSourceID="AuthorLinksSqlDataSource" 
                            OnRowDataBound="DBInterfaceGridView_RowDataBound" AutoGenerateColumns="False" 
                            OnRowUpdating="DBInterfaceGridView_RowUpdating"    
                            OnRowDeleting="DBInterfaceGridView_RowDeleting"  
                            Width="800px" Height="306px"  DataKeyNames="ID" 
                            CssClass="largegridview" Visible="False" 
                            onrowediting="DBInterfaceGridView_RowEditing" >
                    <AlternatingRowStyle CssClass="alternatingrowstyle" />
                    <Columns>
                         <asp:TemplateField>  
                            <ItemTemplate>   
                                <asp:ImageButton ID="btnEdit"   runat="server" Text="Edit"      CommandName="Edit"   ImageUrl="~/Images/Edit.gif"   ToolTip="Edit"   CausesValidation="False"></asp:ImageButton>  
                                <asp:ImageButton ID="btnDelete" runat="server" Text="Delete"    CommandName="Delete" ImageUrl="~/Images/Delete.gif" ToolTip="Delete" CausesValidation="False" OnClientClick = "return confirm('Are you sure you want to delete this record?')"></asp:ImageButton>  
                            </ItemTemplate>  
                            <EditItemTemplate>   
                                <asp:ImageButton ID="btnUpdate" runat="server" Text="Update"    CommandName="Update" ImageUrl="~/Images/Update.gif" ToolTip="Update" OnClientClick = "return confirm('Are you sure you want to update this …
dpreznik 0 Light Poster

I have an MFC application. On the following line
MonoBuff = new short[iSize];
an exception is thrown that is caught in CATCH_ALL(e) block in wincore.cpp, getting "Warning: Uncaught exception in WindowProc".
It is said to be a CMemoryException. Surprisingly, when I tried to use try/catch block in my code, CMemoryException was not caught. I replaced it with catch(CException* ex), and caught it. Again, it is said to be CMemoryException.
Can anybody explain to me such a behavior? And maybe someone can give me an advice how to prevent this exception?
Here is a part of the code:

CString strWAVFile = GetWAVFilePath();

      short* MonoBuff = NULL;

      try
      {
//.... some other code
                  MonoBuff = new short[iSize];
//.... some other code
      }
      catch(WaveErrors::FileOperation & )
      {
            AfxMessageBox("File operation error!\n", MB_ICONSTOP);
            return;
      }
      catch(WaveErrors::RiffDoesntMatch & )
      {
            AfxMessageBox("Riff doesn't match!\n", MB_ICONSTOP);
            return;
      }
      catch(WaveErrors::WaveDoesntMatch & )
      {
            AfxMessageBox("Wave doesn't match!\n", MB_ICONSTOP);
            return;
      }
      catch(WaveErrors::DataDoesntMatch & )
      {
            AfxMessageBox("Data doesn't match!\n", MB_ICONSTOP);
            return;
      }
      catch(WaveErrors::FmtDoesntMatch & )
      {
            AfxMessageBox("Format doesn't match!\n", MB_ICONSTOP);
            return;
      }
      catch(WaveErrors::BextDoesntMatch & )
      {
            AfxMessageBox("BEXT Format doesn't match!\n", MB_ICONSTOP);
            return;
      }
      catch(CMemoryException* ex) // doesn't catch, but catches if replaced with CException
      {
            char msg[1000];
            ex->GetErrorMessage(msg, 1000);
            AfxMessageBox(msg);
      }

I debugged watching Mem Usage in Task Manager.

I noticed that after execution of
CString strWAVFile = GetWAVFilePath();
Mem Usage jumps from approximately 10MB to 14MB. It is not much, but after I replaced this line with hard coded path, it stays …

dpreznik 0 Light Poster

It seems like my code interferes with code in master page:

<asp:ContentPlaceHolder id="ContentPlaceHolder1" runat="server">
                </asp:ContentPlaceHolder>
                </div>
            </td>
        </tr>
        <tr>
            <td colspan = "2" >
                <div>
                Copyright 2008 - MyCompany&nbsp;
                </div>
            </td>
        </tr>
    </table>
    </form>

When I am trying to grasp and drag my grid, it starts correctly, but immediately starts dragging the "Copyright 2008 - MyCompany" part of the masterpage instead.

dpreznik 0 Light Poster

Do you want to resize the columns of a GridView?

First of all, I want to be able to resize my grid itself.

I use the following code, but it doesn't work: I can resize the panel containing the grid, but not the grid itself:

<%@ Page Title="" Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true" CodeFile="GridViewRecizable.aspx.cs" Inherits="GridViewRecizable" %>  
    <%@ Register assembly="AjaxControlToolkit" namespace="AjaxControlToolkit" tagprefix="ajaxToolkit" %>  
      
    <asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">  
    </asp:Content>  
    <asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">  
       <style type="text/css">  
            .handle  
           {  
               width: 16px;  
               height: 16px;  
               background-image: url(image/HandleGrip.png);  
               overflow: hidden;  
               cursor: se-resize;  
           }  
       </style>  
   <div>  
       <asp:ScriptManager ID="ScriptManager1" runat="server">  
   </asp:ScriptManager>  
    
   <script type="text/javascript">  
   function onResize(sender, eventArgs)  
   {  
       var e = sender.get_element();  
       alert("Current height and width of Resizable Panel:\n\nwidth: " + e.scrollWidth + ", height: " + e.scrollHeight);  
   }  
   </script>  
   <ajaxToolkit:ResizableControlExtender  
        ID="ResizableControlExtender2"  
        runat="server"  
        TargetControlID="Panel1"  
        MinimumHeight="20"  
        MinimumWidth="20"  
        HandleCssClass="handle"  
        HandleOffsetX="10"   
        HandleOffsetY="10"   
        OnClientResize="onResize">  
   </ajaxToolkit:ResizableControlExtender>  
     
   <asp:Panel ID="Panel1" runat="server">  
       <asp:GridView ID="grdResizable" runat="server"  
           DataSourceID="SqlDataSource1" AllowPaging="True" Width="100%" Height="100%"  
           AutoGenerateColumns="False">  
           <Columns>  
               <asp:BoundField DataField="BookStem" HeaderText="BookStem" ReadOnly="True"   
                   SortExpression="BookStem" />  
               <asp:BoundField DataField="Updated" HeaderText="Updated" ReadOnly="True"   
                   SortExpression="Updated" />  
               <asp:BoundField DataField="Released" HeaderText="Released" ReadOnly="True"   
                   SortExpression="Released" />  
               <asp:BoundField DataField="Title" HeaderText="Title" ReadOnly="True"   
                   SortExpression="Title" />  
               <asp:BoundField DataField="Subtitle" HeaderText="Subtitle" ReadOnly="True"   
                   SortExpression="Subtitle" />  
           </Columns>  
       </asp:GridView>  
   </asp:Panel>  
   </div>  
       <asp:SqlDataSource ID="SqlDataSource1" runat="server"   
           ConnectionString="<%$ ConnectionStrings:BookList %>"   
           ProviderName="<%$ ConnectionStrings:BookList.ProviderName %>"   
           SelectCommand="SELECT ' ' AS BookStem, ' ' AS Updated, ' ' AS Released, ' ' AS Title, ' ' AS Subtitle FROM booklist ORDER BY BookStem;"></asp:SqlDataSource>  
   </asp:Content>
dpreznik 0 Light Poster

Dear friends,

Could somebody please help me make a gridview that can be resized with a mouse?

Thank you in advance,
Dmitriy

dpreznik 0 Light Poster

Added post by mistake, sorry.

dpreznik 0 Light Poster

Hi,
Maybe somebody could help me set a popup menu item text at runtime in MFC?
Because of some reason, the following code doesn't work for me:

if(pDoc->m_pCurChapter->m_pMarkedParagraph->m_bFlagged)
		menu.GetSubMenu(0)->ModifyMenu(ID_FLOATING_MENU_FLAG_PICKUP, MF_BYCOMMAND|MF_STRING|MF_POPUP, ID_FLOATING_MENU_FLAG_PICKUP, "Unflag Pickup");		
	else
		menu.GetSubMenu(0)->ModifyMenu(ID_FLOATING_MENU_FLAG_PICKUP, MF_BYCOMMAND|MF_STRING|MF_POPUP, ID_FLOATING_MENU_FLAG_PICKUP, "Flag Pickup");
dpreznik 0 Light Poster

Maybe somebody could help me find code for upsampling audio data from .wav file? I have it stored in an array of SHORT integers.

Thank you in advance.

dpreznik 0 Light Poster

Getting an hour glass cursor using MFC is generally a simple case of declaring:
CWaitCursor myWaitCursor;
inside a method. The wait cursor is then displayed for the duration of that method. It is removed when the object is destroyed. Very little for you to do.

Thank you. I like it very much. But because of some reason, the wait cursor still does not show up. What can the reason be?

dpreznik 0 Light Poster

Thank you Frederick. But I really prefer to use MFC if possible.

dpreznik 0 Light Poster

Dear friends,

I need a help with a Wait (Hour Glass) cursor. In my MFC program, I have the following code:

void CBookDoc::SomeMethod() 
{
	AfxGetApp()->DoWaitCursor(1); // display the hourglass cursor
...
// Some stuff is done
...
	AfxGetApp()->DoWaitCursor(-1); // -1->>remove the hourglass cursor
}

I wonder why the cursor never changes to show the hour glass?

dpreznik 0 Light Poster

Maybe somebody could please help me understand why I fail to write stl's map of vectors into a file using CFile::Write()?

typedef std::vector<CLocation> LocationArray;
typedef std::map<int, LocationArray > MapLocationArray;

...

int iSize = sizeof(m_mapLocations);
		cf->Write(&iSize, sizeof(iSize));
		cf->Write(&m_mapLocations, iSize);

When I am writing, the m_mapLocations contains valid data. But when I read from file, it is empty, though the iSize is correct...

int iSize = 0;
		cf->Read(&iSize, sizeof(iSize));
		if(iSize > 0)
			cf->Read(&m_mapLocations, iSize);
dpreznik 0 Light Poster

I am facing a problem with a CArray. I have a class member of type CArray<MyType, MyType&> m_MyArray;
When the object is destroyed, of course the destructor of CArray<MyType, MyType&> is called.

Here is the destructor:

template<class TYPE, class ARG_TYPE>
CArray<TYPE, ARG_TYPE>::~CArray()
{
	ASSERT_VALID(this);

	if (m_pData != NULL)
	{
		for( int i = 0; i < m_nSize; i++ )
			(m_pData + i)->~TYPE();
		delete[] (BYTE*)m_pData;
	}
}

The debugger shows my m_pData to be 0X00000005.
As we can see from the code above, delete[] is called on this pointer because it is not NULL. The delete[] calls delete, which calls _free_dbg(), which calls CheckBytes(), where the pointer is passed already as 0X00000000 (bad ptr). On attempt to dereference this pointer ( if (*pb++ != bCheck)), a crash happens.
Can somebody help me solve this problem, please?
Thanks.

dpreznik 0 Light Poster

Ramesh, thank you very much for your answer.
No, I don't use UpdatePanel.
And checking for IsPostBack() doesn't help either, I think, because the report actually shows data on post back after submitting the column selection page (I believe it is considered the same page as the report). If I do checking, the report is empty.
I am already thinking that probably I should go away from using automatically generating column selection page by providing the parameters instead of just waiting for reports to ask for them...

dpreznik 0 Light Poster

As I understand, my problem happens because pressing on any report's button causes postback that brings me back to the column selection page. E.g. if I press Pring button, and popups are allowed, a new Printer settings window will appear (which is good), but the report page will go back to the Column selection page.

Please! Help me solve this.

Thanks,
Dmitriy

dpreznik 0 Light Poster

Good news: I solved the first problem!
I still really need help on the second one:
2) On the report, when I press the Export or Print button, instead of the exporting or printing functionality, I am redirected again to the page where the column selection is made. How can I solve this problem?

Thanks,
Dmitriy

dpreznik 0 Light Poster

I doubt the code would help. All specifics that make the report have dynamic columns are set in the .rpt file. That's why I gave the link to the article that explains how to do that.
I didn't code the report to show that page with column selection. It is generated automatically by Crystal, I think.

Thanks,
Dmitriy

dpreznik 0 Light Poster

Dear friends,

I need to make a report that would let the user to pick which columns he wants to see. I found how to do it here:

http://www.c-sharpcorner.com/UploadFile/uditsingh/CR1111022006055359AM/CR11.aspx

This works, but I still have two problems:

1)When you start the report, you see a page with several comboboxes (according to the number of fields available in the report). The comboboxes contain "Use Value..." string at the top, and then "None", and then all possible fields that we specified in our textfile. If you leave "Use Value..." selected, the report shows the column without any caption, with all 0's. Is it possible to hide somehow option "Use Value..." in the comboboxes, and show "None" by default?
2) On the report, when I press the Export button, instead of the exporting functionality, I am redirected again to the page where the column selection is made. How can I solve this problem?

Unfortunately, the author doesn't answer my questions.
Thank you very much in advance. I really need that to be solved.
Dmitriy

dpreznik 0 Light Poster

In my Page_Load() I have the following code:

Button btnCancel = wizSummaryDetails.FindControl("FinishNavigationTemplateContainerID").FindControl("CancelButton") as Button;
            btnCancel.Attributes.Add("onclick", "setSessionAction('NONE');");

Also, I have the following function that handles clicks on the same button:

protected void DetailCancelButton_Click(object sender, EventArgs e)
        {
            wizSummaryDetails.MoveTo(wizStepSummary);
            Session["Action"] = ACTION.NONE;
            LoadData();
        }

But if I have that part in Page_Load(), the DetailCancelButton_Click() is never called. But I need them both.

Could anybody please help me?

Thanks,

Dmitriy

dpreznik 0 Light Poster

I don't know why it didn't work before... Suddenly it started working now. Thank you so much for your help.

dpreznik 0 Light Poster

Thank you sknake,

I change the code like this:

protected new void Page_Load(object sender, EventArgs e)
        {
            base.Page_Load(sender, e);
            Value.TextChanged += new EventHandler(OnValueChanged);

            if (!IsPostBack)
            {
...
            }
        }

But it the event still does not fire. :(

I even tried to wire up in overridden OnInit()... with the same result.


Dmitriy

dpreznik 0 Light Poster

Could anybody please explain to me why my TextChanged event doesn't fire?

protected new void Page_Load(object sender, EventArgs e)
        {
            base.Page_Load(sender, e);
            if (!IsPostBack)
            {
                Value.TextChanged += new EventHandler(OnValueChanged);
            }
        }


protected void OnValueChanged(object sender, EventArgs e)
        {
            ViewState["IsModified"] = true;
        }

The Value textbox is on the second page of a wizard control. AutoPostBack for Value is set to true.


I just don't get what causes it.


Thank you very much,


Dmitriy

dpreznik 0 Light Poster

Thanks.
But my textboxes are in the second wizard's step, and on refreshing I get to the first step. Plus, I just don't get why it doesn't work on simple changing the textbox's content? If I subscribe for the TextChanged event through the designer, it works. But not when I do it programmatically.

dpreznik 0 Light Poster

Could you please tell me more about 1) because I don't really know anything about it. Where and how that should be done?
2) With a button, OnValueChanged() is called.

dpreznik 0 Light Poster

Thanks, it did help. I still have problem though. Here is how I use it:

protected void OnValueChanged(object sender, EventArgs e)
        {
            ViewState["IsModified"] = true;
        }

        protected void SubscribeForOnChange(Control parent)
        {
            foreach (Control ctrControl in parent.Controls)
            {
                //Loop through all controls
                if (object.ReferenceEquals(ctrControl.GetType(), typeof(TextBox)))
                {
                    ((TextBox)ctrControl).AutoPostBack = true;
                    ((TextBox)ctrControl).TextChanged += new EventHandler(OnValueChanged);
                }
...
            }
        }

I call this method from my custom code behind parent class' Page_Load:

protected void Page_Load(object sender, EventArgs e)
        {            
            if (!IsPostBack && wizSummaryDetails.ActiveStep == wizStepSummary)
            {
                ViewState["IsModified"] = false;
                SubscribeForOnChange(this);
...

But when I run the application and change the value in the textbox, I do not come to OnValueChanged(). Could you explain why it doesn't happen?

Thank you very much,
Dmitriy

dpreznik 0 Light Poster

I have a wizard control. On one of its pages I have various controls like textboxes and checkboxes. Could anybody please tell me how I can check from my code (e.g. on Cancel) if the contents of the controls has been changed? I know how to check if each control was changed separately, but is there any way to check the page as a whole?

dpreznik 0 Light Poster

Hello,
I found the answer. I found where I changed the active step. I handle click on the gridview to go to the Details step and edit the selected row. But I didn't realize that clicking on the column header also will fire the same event. But thank you for your wish to help.

dpreznik 0 Light Poster

I have a wizard control with two steps: Summary and Details. Within Summary, I have a gridview. When I click on the gridview column's header to sort the data, for some reason I am redirected to the next, Details wizard step. Could anybody please tell me why it happens and how I could avoid this going to the next step?


Thanks,

Dmitriy