在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不能够正常运行
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不能够正常运行
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
在后台给dropdownlist加了onchange事件,在前台用Javascript脚本判断是不是选中了特定选项。
如果是,用window.showModalDialog()打开一个窗口。不知道是不是符合楼主的要求。
<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" />
在ContentPage 添加<link ....../>元素好像有点问题
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脚本就行了。
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
...
<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>