首页 新闻 搜索 专区 学院

在TabContainer 控件外放一个UpdatePanel 控件实现无刷新,但是在Repeater控件的附件就无法弹出来 ?

0
悬赏园豆:30 [已关闭问题] 关闭于 2012-12-03 14:52

前台页面绑定:

<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<cc1:TabContainer ID="TabContainer1" runat="server" ActiveTabIndex="0"
Height="163px" Width="338px">
<cc1:TabPanel ID="TabPanel1" runat="server" HeaderText="附件">
<ContentTemplate>内容</ContentTemplate>
</cc1:TabPanel>
<cc1:TabPanel ID="TabPanel2" runat="server" HeaderText="附件">
<ContentTemplate>内容</ContentTemplate>
</cc1:TabPanel>
 <cc1:TabPanel ID="TabPanel3" runat="server" HeaderText="附件">
<ContentTemplate>

<table class="tblist">
<asp:Repeater ID="repAttach" runat="server" OnItemCommand="repAttach_ItemCommand">
<HeaderTemplate>
<tr>
<td width="140px" class="td_list_title">
附件类型
</td>
<td width="502px" class="td_list_title">
附件文件名
</td>
<td width="36px" class="td_list_title">
操作
</td>
</tr>
</HeaderTemplate>
<ItemTemplate>
<tr onmouseover="repOver(this)" onmouseout="repOut(this)">
<td width="140px" class="td_listdata">
<%# Eval("ATTACHTYPEDESC")%>
</td>
<td align="left" width="502px" class="td_listdata">
&nbsp;<asp:LinkButton ID="linkbtn_Attach" CommandArgument='<%# Eval("intelno")+","+Eval("SEQNO") %>'
CommandName="attachView" runat="server"><%# Eval("ATTACHFILENAME")%></asp:LinkButton>
</td>
<td width="36px" class="td_listdata">
<asp:LinkButton ID="linkbtn_Del" CommandArgument='<%# Eval("intelno")+","+ Eval("SEQNO") %>'
CommandName="iddel" runat="server" OnClientClick="javascript:return confirm('确认要删除吗?');">删除</asp:LinkButton>
</td>
</tr>
</ItemTemplate>
<FooterTemplate>
<tr>
<td colspan="5" class="foot_empty">
<asp:Label ID="labEmpty" runat="server" Text="没有数据" Visible='<%# bool.Parse((repAttach.Items.Count==0).ToString()) %>'>
</asp:Label>
</td>
</tr>
</FooterTemplate>
</asp:Repeater>
 </table>

</ContentTemplate>
</cc1:TabPanel>
</cc1:TabContainer>
</ContentTemplate>
 </asp:UpdatePanel>

-----------------------------------------

后台CS文件:

//附件浏览操作
protected void repAttach_ItemCommand(object source, RepeaterCommandEventArgs e)
{
if (e.CommandName == "attachView") //浏览附件标准
{
string[] strarry = e.CommandArgument.ToString().Split(',');
string strIntelno = strarry[0].ToString();//
string strSEQNO = strarry[1].ToString();//序号
try
{
//附件信息
OracleDataReader dr = intelbll.GetAttachRead(strIntelno, strSEQNO);
if (dr.HasRows)
{
dr.Read();
// 开始读取数据// 获取文件
string strFileName = dr["ATTACHFILENAME"].ToString();
string strFileContent = dr["ATTACHCONTENT"].ToString();

int intExproChaIndex = strFileName.LastIndexOf(".");
if (intExproChaIndex > 0)
{
string strFileType = strFileName.Substring(intExproChaIndex + 1);
// 获取Response.ContentType
string strResContentType = "";
switch (strFileType)
{
case "doc":
strResContentType = "application/msword";
break;
case "ppt":
strResContentType = "application/vnd.ms-powerpoint";
break;
case "htm":
strResContentType = "text/html";
break;
case "jpg":
strResContentType = "image/jpeg";
break;
case "gif":
strResContentType = "image/gif";
break;
case "txt":
strResContentType = "text/plain";
break;
default:
strResContentType = "text/plain";
break;
}
if (strFileContent == "")
{
Page.ClientScript.RegisterStartupScript(Page.GetType(), "message", "<script> alert('你要查看的" + strFileName + "是空的,无法下载或查看!');');</script>");
}
else
{
byte[] objFileBuffer = (byte[])dr["ATTACHCONTENT"];
Response.Clear();
Response.ClearContent();
Response.ClearHeaders();
Response.HeaderEncoding = Encoding.Default;

Response.AddHeader("Content-Disposition", "attachment; filename=" + HttpContext.Current.Server.UrlEncode(strFileName));
Response.ContentType = strResContentType;
Response.ContentEncoding = System.Text.Encoding.UTF8;
//HttpContext.Current.Response.ContentEncoding = System.Text.Encoding.UTF8;
//HttpContext.Current.Response.Charset = "gb2312";
Response.OutputStream.Write(objFileBuffer, 0, objFileBuffer.Length);
Response.Flush();
Response.OutputStream.Close();
Response.End();
}
dr.Close();
}
}
}
catch (Exception ex)
{
throw ex;
}
}

if (e.CommandName == "iddel") //删除
{
string[] arrId = e.CommandArgument.ToString().Split(',');
string strIntelId = arrId[0].ToString();
int NSeqId = Convert.ToInt32(arrId[1].ToString());
BLL.Intel_Attach attachbll = new BLL.Intel_Attach();
int n = attachbll.DelIntel_Attach(strIntelId, NSeqId);
if (n > 0)
{
//附件
ShowAttachList(strIntelId);
}
else
{
Common.MessageBox.Show(this, "删除失败!");
}}}

其中附件是用二进制保存到数据库的,所以用这个方法 绑定在弹出来显示!但是用了UpdatePanel 控件就无法弹出附件了。请问如何修改???

小哑巴的主页 小哑巴 | 初学一级 | 园豆:6
提问于:2012-11-22 10:30
< >
分享
所有回答(2)
0

页面截图看下啊!

MingHao_Hu | 园豆:8 (初学一级) | 2012-11-22 10:38

谢谢了,问题搞定了,在updatepanel添加

<Triggers>

<asp:PostBackTrigger ControlID= "TabContainer$TabPanel1$btnUpdate"/>

<Triggers/>

支持(0) 反对(0) 小哑巴 | 园豆:6 (初学一级) | 2012-11-22 11:08
0

谢谢了,问题搞定了,在updatepanel添加

<Triggers>

<asp:PostBackTrigger ControlID= "TabContainer$TabPanel1$btnUpdate"/>

<Triggers/>

小哑巴 | 园豆:6 (初学一级) | 2012-11-22 11:09
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册