在ContentPage中<asp:GridView ID="gviewReceive" runat="server" AutoGenerateColumns="False" BackColor="White"
      BorderColor="#3366CC" BorderStyle="None" BorderWidth="1px" CellPadding="4" Font-Size="Small">
            <FooterStyle BackColor="#99CCCC" ForeColor="#003399" />
            <RowStyle BackColor="White" ForeColor="#003399" />
            <SelectedRowStyle BackColor="#009999" Font-Bold="True" ForeColor="#CCFF99" />
            <PagerStyle BackColor="#99CCCC" ForeColor="#003399" HorizontalAlign="Left" />
            <HeaderStyle BackColor="#003399" Font-Bold="True" ForeColor="#CCCCFF" />
            <Columns>

                <asp:TemplateField HeaderText="验收状态">
                    <EditItemTemplate>
                        <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
                    </EditItemTemplate>
                    <ItemTemplate>
                        <asp:DropDownList ID="ddlstate" runat="server" AutoPostBack="True"              OnSelectedIndexChanged="ddlstate_SelectedIndexChanged"
                            Width="90px" >
                            <asp:ListItem Selected="True" Value="0">未处理</asp:ListItem>
                            <asp:ListItem Value="1">全部接收</asp:ListItem>
                            <asp:ListItem Value="2">
                            <a href="Default2.aspx?keepThis=true&TB_iframe=true&height=250&width=400" title="add a caption to title attribute / or leave blank" class="thickbox"></a>有异议</asp:ListItem>
                        </asp:DropDownList>
                    </ItemTemplate>
                </asp:TemplateField>。
</asp:GridView>
当选择驳回时候,才弹出thickbox。 thickbox内嵌的是网页default2.aspx <a href="Default2.aspx?keepThis=true&TB_iframe=true&height=250&width=400" title="add a caption to title attribute / or leave blank" class="thickbox">例子1 </a> 如果只在普通webPage中,问题就解决了,方法如下:    Protected Sub ddlstate_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs)
        Dim ddlist As DropDownList = CType(sender, DropDownList)
        Dim Row As GridViewRow = ddlist.Parent.Parent
        If ddlist.SelectedValue = 2 Then
            ClientScript.RegisterStartupScript([GetType](), "show", "$(document).ready(function(){ tb_show('add a caption to title attribute / or leave blank','Default2.aspx?keepThis=true&TB_iframe=true&height=250&width=400',false);});", True)
        End If
但是在ContentPage中就出现问题,thickbox不能够正常运行

解决方案 »

  1.   

    放上去了    Public Sub AddInLineStyle(ByVal style As String, ByVal page As Page)
            Dim node As HtmlGenericControl = New HtmlGenericControl("Style")
            node.Attributes.Add("type", "text/css")
            node.InnerText = style
            Page.Header.Controls.Add(node)
        End Sub    Public Sub AddOuterJavascriptFile(ByVal FilePath As String, ByVal page As Page)
            Dim node As HtmlGenericControl = New HtmlGenericControl("script")
            node.Attributes.Add("type", "text/javascript")
            node.Attributes.Add("src", FilePath)
            page.Header.Controls.Add(node)
        End Sub    Public Sub AddLinkingFile(ByVal FilePath As String, ByVal page As Page)
            '    Dim node As HtmlGenericControl = New HtmlGenericControl("link")
            '    node.Attributes.Add("rel", "stylesheet")
            '    node.Attributes.Add("type", "text/css")
            '    node.Attributes.Add("media", "screen")
            '    node.Attributes.Add("href", FilePath)
            '    page.Header.Controls.Add(node)        '            // Define an HtmlLink control.   
            ' HtmlLink myHtmlLink = new HtmlLink();   
            ' myHtmlLink.Href = csspath;    
            'myHtmlLink.Attributes.Add("rel", "stylesheet");    
            'myHtmlLink.Attributes.Add("type", "text/css");    
            '// Add the HtmlLink to the Head section of the page.   
            ' Page.Header.Controls.Add(myHtmlLink);        Dim myHtmlLink As HtmlLink = New HtmlLink()
            myHtmlLink.Href = FilePath
            myHtmlLink.Attributes.Add("rel", "stylesheet")
            myHtmlLink.Attributes.Add("type", "text/css")
            myHtmlLink.Attributes.Add("media", "screen")
            page.Header.Controls.Add(myHtmlLink)
        End Sub加载    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
            comt = New CommonType
            If Not Page.IsPostBack Then
                comt.AddLinkingFile("CSS/thickbox.css", Page)
                comt.AddOuterJavascriptFile("Js/calendar.js", Page)
                comt.AddOuterJavascriptFile("Js/jquery-1.1.3.1.pack.js", Page)
                comt.AddOuterJavascriptFile("Js/thickbox.js", Page)
            End If
        End Sub
      

  2.   

    我做过跟这个差不多的。
    在后台给dropdownlist加了onchange事件,在前台用Javascript脚本判断是不是选中了特定选项。
    如果是,用window.showModalDialog()打开一个窗口。不知道是不是符合楼主的要求。
      

  3.   

    是否js脚本和css问题
    <script type="text/javascript" src="js/jquery.js"></script> 
    <script type="text/javascript" src="js/thickbox.js"></script> 
    <link rel="stylesheet" href="css/thickbox.css" type="text/css" media="screen" /> 
      

  4.   

    ScriptManage.RegisterStartupScript(this.updatePanle1,[GetType](), "show", "$(document).ready(function(){ tb_show('add a caption to title attribute / or leave blank','Default2.aspx?keepThis=true&TB_iframe=true&height=250&width=400',false);});", True)
      

  5.   


    在ContentPage 添加<link ....../>元素好像有点问题
      

  6.   

    需要把css,javascript文件添加到MasterPage中,郁闷
      

  7.   

    我的javascript脚本就是直接加到contentpage里面的,没有问题啊。
      

  8.   

    --后台代码
    string ID = ddlGroups.ClientID;
    ddlGroups.Attributes.Add("onchange", "OnGroupChange(" + ID + "," + AccountId +","+ RecordId + ")");--前台代码
    function OnGroupChange(ID,AccountID,GroupID)
        {
               var v = $(ID).val();
               if(v == '-1'){
                window.showModalDialog('CreateGroup.aspx?RecordId=' + GroupID+'&AccountID='+AccountID,'newwindow','dialogWidth=780px;dialogHeight=500px');
              }
        }
    我用了jquery,你不用的话,把“var v = $(ID).val();”改成普通的javascript脚本就行了。
      

  9.   

    问题不在 thickbox 应该是你添加js 的地方有问题
      

  10.   


    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
            comt = New CommonType  
            comt.AddOuterJavascriptFile("Js/jquery-1.1.3.1.pack.js", Page)
            comt.AddOuterJavascriptFile("Js/thickbox.js", Page)      
            comt.AddOuterJavascriptFile("Js/calendar.js", Page)
            comt.AddLinkingFile("CSS/thickbox.css", Page)
                
                    End Sub
      

  11.   


    ...
    <asp:DropDownList ID="ddlstate" runat="server" AutoPostBack="True"              OnSelectedIndexChanged="ddlstate_SelectedIndexChanged"
                                Width="90px" >
                                <asp:ListItem Selected="True" Value="0">未处理</asp:ListItem>
                                <asp:ListItem Value="1">全部接收</asp:ListItem>
                                <asp:ListItem Value="2">
                                <a href="Default2.aspx?keepThis=true&TB_iframe=true&height=250&width=400" title="add a caption to title attribute / or leave blank" class="thickbox"></a>有异议</asp:ListItem>
                            </asp:DropDownList>
    ...<asp:DropDownList ID="ddlstate" runat="server" AutoPostBack="True"              OnSelectedIndexChanged="ddlstate_SelectedIndexChanged"
                                Width="90px" >
                                <asp:ListItem Selected="True" Value="0">未处理</asp:ListItem>
                                <asp:ListItem Value="1">全部接收</asp:ListItem>
                                <asp:ListItem Value="2">有异议</asp:ListItem>
                            </asp:DropDownList>
      

  12.   

    看HTML输出,用母版页后ID会变得
      

  13.   

    这个问题和母板页 没有关系 ~ 是因为你把 加载js 的代码 放在 If Not Page.IsPostBack Then 中了这样只有在第一次 加载的时候 才会注册 js  ,所以一回发  就会报找不到对象的错误了还一个需要注意的地方  就是 js 加载的 顺序 ,jQuery 放前面 然后才是其他插件