当我点击另一个事件的按钮时,Div不会被隐藏

时间:2010-05-24 06:12:10

标签: c# asp.net scripting

我使用服务器端代码来隐藏div,但当我点击另一个事件的按钮工具时,div始终打开。我正在使用ASP.net C#代码。

下面的老板是我的代码...我使用chekbox来控制div ...但是当我点击服务器端代码的按钮时这个div是开放的 PLZ解决问题

****<div id="ChargeInvSlab"  style="display:inline; width:100%; border:1px solid Gray" >
<table >
<tr>
    <td>
        <dxe:ASPxLabel ID="ASPxLabel3" runat="server" Text="Amount From" Width="100px">
        </dxe:ASPxLabel>


        </td>
    <td >
        <dxe:ASPxTextBox ID="ASPxTxtboxAmountInvestor" runat="server" Width="170px" 
            ClientInstanceName="ASPxTxtboxAmountInvestor" MaxLength="13">
            <ValidationSettings SetFocusOnError="True">

                    </ValidationSettings>
                    <ClientSideEvents KeyUp="function(s, e) {ConvertNumberToWordInvestor12(s,e); }" />
             <ClientSideEvents KeyPress="function(s, e) {CheckAmount(event);
}" />       
        </dxe:ASPxTextBox>
    </td>
    <td >
        <dxe:ASPxLabel ID="ASPxLabel7" runat="server" Text="Amount To" Width="100px">
        </dxe:ASPxLabel>
        </td>
    <td >
        <dxe:ASPxTextBox ID="ASPxtxtAmounttoInvestor" runat="server" Width="170px" 
            ClientInstanceName="ASPxtxtAmounttoInvestor" MaxLength="13" >
            <ValidationSettings SetFocusOnError="True">

                    </ValidationSettings>
                    <ClientSideEvents KeyUp="function(s, e) {ConvertNumberToWordInvestor12(s,e); }"  />
                     <ClientSideEvents KeyPress="function(s, e) {CheckAmount(event);
}" />  
        </dxe:ASPxTextBox>
    </td>

</tr>
<tr>
    <td >
        <dxe:ASPxLabel ID="ASPxLabel4" runat="server" Text="Charge Rate" Width="100px">
        </dxe:ASPxLabel>
        </td>
    <td >
    <dxe:ASPxTextBox ID="ASPxTxtChargeRateSlabInvestor" runat="server" Width="170px" 
            ClientInstanceName="ASPxTxtChargeRateSlabInvestor" MaxLength="5">
            <ValidationSettings SetFocusOnError="True">

                    </ValidationSettings>
                    <ClientSideEvents KeyUp="function(s, e) {ConvertNumberToWordInvestor12(s,e); }"  />
                    <ClientSideEvents KeyPress="function(s, e) {CheckAmount(event);
}" />  
        </dxe:ASPxTextBox>
    </td>

    <td >
    <dxe:ASPxLabel ID="ASPxLabel9" runat="server" Text="Minimum Charge " Width="100px">
    </dxe:ASPxLabel>
    </td>
    <td >
    <dxe:ASPxTextBox ID="ASPxTxtMinimumCharge_slabInvestor" runat="server" Width="170px" 
            MaxLength="13" ClientInstanceName="ASPxTxtMinimumCharge_slabInvestor">
     <ValidationSettings SetFocusOnError="True">

                    </ValidationSettings>
                    <ClientSideEvents KeyUp="function(s, e) {ConvertNumberToWordInvestor12(s,e); }"  />
                     <ClientSideEvents KeyPress="function(s, e) {CheckAmount(event);
}" />  
        </dxe:ASPxTextBox>
    </td>
</tr>
<tr>

<td >

        </td>
    <td >

    </td>

<td >
        <dxe:ASPxButton ID="ASPxButtonAdd" runat="server" 
            Text="ADD" onclick="ASPxButtonAdd_Click">
        </dxe:ASPxButton>
        </td>
    <td >
        <dxe:ASPxButton ID="ASPxButtonClear" runat="server" Text="Clear" 
            onclick="ASPxButtonClear_Click">
        </dxe:ASPxButton>
    </td>
</tr>
<tr>
 <td colspan="4">
   <dxwgv:ASPxGridView ID="ASPxGridViewAddInvestor" runat="server" 
        AutoGenerateColumns="False" 
        ClientInstanceName="ASPxGridViewAddInvestor" EnableCallBacks="False" Width="400px" 
         DataSourceID="CslaDataSourceAddGreed" KeyFieldName="SlabSerialNo">
        <SettingsBehavior AllowFocusedRow="True" />
        <SettingsText EmptyDataRow="EmptyDataRow = 'No Data Exists'" />
        <ClientSideEvents FocusedRowChanged="function(s, e) {LoadViewAllDataInvestor();}" />
        <TotalSummary>
            <dxwgv:ASPxSummaryItem FieldName="Slab_Serial_No" ShowInColumn="SlabSerialNo" SummaryType="Count" />

        </TotalSummary>
        <Columns>
            <dxwgv:GridViewDataTextColumn FieldName="ClientCompanyId" Visible="False" 
                VisibleIndex="0">
            </dxwgv:GridViewDataTextColumn>
            <dxwgv:GridViewDataTextColumn FieldName="ProductId" Visible="False" 
                VisibleIndex="0">
            </dxwgv:GridViewDataTextColumn>
            <dxwgv:GridViewDataTextColumn FieldName="InvestorAccountId" Visible="False" 
                VisibleIndex="1">
            </dxwgv:GridViewDataTextColumn>
            <dxwgv:GridViewDataTextColumn FieldName="ChargeId" Visible="False" 
                VisibleIndex="0">
            </dxwgv:GridViewDataTextColumn>
            <dxwgv:GridViewDataTextColumn FieldName="SlabSerialNo" Visible="False" 
                VisibleIndex="2">
            </dxwgv:GridViewDataTextColumn>
            <dxwgv:GridViewDataTextColumn FieldName="SlabAmountFrom" VisibleIndex="0">
                <PropertiesTextEdit DisplayFormatString="{0:n2}">
                </PropertiesTextEdit>
            </dxwgv:GridViewDataTextColumn>
            <dxwgv:GridViewDataTextColumn FieldName="SlabAmountTo" VisibleIndex="1">
                <PropertiesTextEdit DisplayFormatString="{0:n2}">
                </PropertiesTextEdit>
            </dxwgv:GridViewDataTextColumn>
            <dxwgv:GridViewDataTextColumn FieldName="SlabChargeRate" VisibleIndex="2">
                <PropertiesTextEdit DisplayFormatString="{0:n2}">
                </PropertiesTextEdit>
            </dxwgv:GridViewDataTextColumn>
            <dxwgv:GridViewDataTextColumn FieldName="RecordStatus" Visible="False" 
                VisibleIndex="5">
            </dxwgv:GridViewDataTextColumn>
            <dxwgv:GridViewDataTextColumn FieldName="MakerId" Visible="False" 
                VisibleIndex="5">
            </dxwgv:GridViewDataTextColumn>
            <dxwgv:GridViewDataTextColumn FieldName="CheckerId" Visible="False" 
                VisibleIndex="5">
            </dxwgv:GridViewDataTextColumn>
            <dxwgv:GridViewDataTextColumn FieldName="AuthorizerId" Visible="False" 
                VisibleIndex="5">
            </dxwgv:GridViewDataTextColumn>
            <dxwgv:GridViewDataTextColumn FieldName="RecordActionType" Visible="False" 
                VisibleIndex="5">
            </dxwgv:GridViewDataTextColumn>
            <dxwgv:GridViewDataTextColumn FieldName="MinimumChargeAmount" VisibleIndex="3">
                <PropertiesTextEdit DisplayFormatString="{0:n2}">
                </PropertiesTextEdit>
            </dxwgv:GridViewDataTextColumn>
        </Columns>
        <Settings ShowFooter="True" />
    </dxwgv:ASPxGridView>
                 <dxhf:ASPxHiddenField ID="ASPxHiddenFieldSlabSerialnoInvestor" 
        runat="server" ClientInstanceName="ASPxHiddenFieldSlabSerialnoInvestor">
                    </dxhf:ASPxHiddenField>
    </td>
</tr>
</table>
</div>****

2 个答案:

答案 0 :(得分:0)

确保您的div标有 runat server ,并且从您的代码中将display属性设置为none以隐藏div。

答案 1 :(得分:0)

尝试使用以下代码。

创建div控制服务器端并使用下面的代码段隐藏它。

divID.visible = false;

或者

divID.style.add("display","none");