div标签可见属性不起作用

时间:2011-07-30 05:30:52

标签: c# asp.net html

我使用c#在asp.net中使用web控件。我用div标签。在btnProviderSubmit1上我改变了divprov的可见性。但divprov是不可见的错误。它可见。

pos.ascx

<%@ Control Language="C#" AutoEventWireup="true" CodeFile="pos.ascx.cs" Inherits="USerControls_Recharge_pos" %>
<%@ Register Assembly="Gaia.WebWidgets" Namespace="Gaia.WebWidgets" TagPrefix="gaia" %>
   <form id="Form1" runat="server">
      <div>
        <div>
            <asp:LinkButton runat="server" ID="moveTo" Text="Go To Classical Mode" PostBackUrl="~/DesktopModules/Recharge/Recharge.aspx" OnClick="SaveCookies"/> 
        </div>

        <div title="Select Provider" id="divprov" **visible="true"** runat="server" style="border-width:medium;border-color:Blue;border-width:medium;">


                <asp:ListView DataSourceID="ObjectDataSource1" GroupItemCount="12"  GroupPlaceholderID="groupPlaceholder" ItemPlaceholderID="itemPlaceholder" ID="ddlprovider" runat="server">
                    <LayoutTemplate  >
                        <table runat="server" id="table2" style="border-width:medium" cellpadding="3">
                          <tr runat="server" id="groupPlaceholder">
                          </tr>
                        </table>
                    </LayoutTemplate>
                    <GroupTemplate>
                        <tr runat="server" id="productRow" style="height:80px">
                            <td runat="server" id="itemPlaceholder">
                            </td>
                        </tr>
                    </GroupTemplate>
                    <ItemTemplate>
                        <td id="Td2" valign="top" align="center" style="width:100" runat="server">
                            <gaia:ImageButton runat="server" CommandArgument='<%#Eval("providerID") %>' **OnCommand="btnProviderSubmit1"** ImageUrl='<%# getImageURL(Eval("providerCode")) %>' ID="ImageButton1" /><br />
                            <gaia:LinkButton runat="server" CommandArgument='<%#Eval("providerID") %>' OnCommand="btnProviderSubmit1" Text='<%#Eval("description")  %>' ID="lnkButton1"/>
                        </td>
                    </ItemTemplate>
                </asp:ListView>
                <asp:ObjectDataSource ID="ObjectDataSource1" runat="server" 
                    DeleteMethod="Delete" InsertMethod="Insert" 
                    OldValuesParameterFormatString="original_{0}" SelectMethod="FetchAll" 
                    TypeName="mogile.MidTier.DAL.ProviderController" UpdateMethod="Update">
                </asp:ObjectDataSource>


          </div>

          <div>
            <gaia:Panel runat="server" ID="pnlCircle" Visible="false" ScrollBars="Auto">

                <asp:ListView ID="ddlCircle" GroupItemCount="8"  GroupPlaceholderID="groupPlaceholder" ItemPlaceholderID="itemPlaceholder" runat="server" DataSourceID="ObjectDataSource2">
                   <LayoutTemplate>
                        <table runat="server" id="table2" cellpadding="3">

                              <tr runat="server" id="groupPlaceholder">
                              </tr>
                        </table>
                   </LayoutTemplate>
                   <GroupTemplate>
                     <tr runat="server" id="tableRow">
                        <td runat="server" id="itemPlaceholder" />
                     </tr>
                    </GroupTemplate>
                    <ItemTemplate>
                        <td id="Td1" runat="server">
                            <gaia:LinkButton ID="LinkButton1" OnCommand="btnCircleSubmit" Font-Size="Larger" BorderColor="red" BorderWidth="4px" runat="server"  CommandArgument='<%#Eval("StateID") %>' Text='<%#Eval("StateName") %>'/>
                        </td>
                    </ItemTemplate>
                </asp:ListView>
                <asp:ObjectDataSource ID="ObjectDataSource2" runat="server" 
                    DeleteMethod="Delete" InsertMethod="Insert" 
                    OldValuesParameterFormatString="original_{0}" SelectMethod="FetchAll" 
                    TypeName="mogile.MidTier.DAL.StateController" UpdateMethod="Update">
                </asp:ObjectDataSource>

            </gaia:Panel>
         </div>

</div></form>

pos.ascx.cs

public partial class USerControls_Recharge_pos : System.Web.UI.UserControl
{
    private static int itemid = 0;
    private static string circleCode;
    private static string pdfText;
    private static string providerName;
    private static string productGrp;
    protected void Page_Load(object sender, EventArgs e)
    {

    }

    protected void btnProviderSubmit1(object sender, CommandEventArgs e)
    {
        providerName = e.CommandArgument.ToString();
        loadProductGroups(e.CommandArgument.ToString());
        pnlCircle.Visible = true;
        **divprov.Visible = false;**


    }

    protected void btnCircleSubmit(object sender, CommandEventArgs e)
    {
        circleCode = e.CommandArgument.ToString();
        pnlProductGrp.Visible = true;

     //   pnlCircle.ForceAnUpdate();
    }
}

1 个答案:

答案 0 :(得分:0)

解决方法可能是在btnClick处理程序中以编程方式添加“display:none”(或者是“visibility:hidden”? - 你可以在这里google)到style属性。