紧急求助,DataList的问题

baishayan_cs 2006-04-26 03:02:42
前台页面代码
<HTML>
<HEAD>
<script language="JavaScript" type="text/JavaScript">
<!--
function MM_preloadImages() { //v3.0
var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}
function MM_swapImgRestore() { //v3.0
var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}
function MM_findObj(n, d) { //v4.01
var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
if(!x && d.getElementById) x=d.getElementById(n); return x;
}
function MM_swapImage() { //v3.0
var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
//-->
</script>
</HEAD>
<
<TABLE id="Table1" style="HEIGHT: 64px" cellSpacing="0" cellPadding="0" width="100%" background="img/main_bar.jpg" border="0">
<TR>
<TD style="HEIGHT: 80px" width="10%"><IMG src="img/newlogo.jpg"><A onmouseover="MM_swapImage('Image2','','button/mainbutton_0up.jpg',1)" onmouseout="MM_swapImgRestore()"></A></TD>
<TD style="HEIGHT: 80px"><A onmouseover="MM_swapImage('Image0','','button/mainbutton_0up.jpg',1)" onmouseout="MM_swapImgRestore()" onmousedown="MM_goToURL('parent.frames[\'main\']','Content.aspx?tabindex=0&connum=0');return document.MM_returnValue" href="top.aspx?id=0" id="href1"><IMG id="Image0" height="79" width="80" border="0" name="Image0" src="button/mainbutton_0out.jpg"></A></TD>
<TD style="HEIGHT: 80px"><A onmouseover="MM_swapImage('Image1','','button/mainbutton_1up.jpg',1)" onmouseout="MM_swapImgRestore()" onmousedown="MM_goToURL('parent.frames[\'main\']','Content.aspx?tabindex=1&connum=0');return document.MM_returnValue" href="top.aspx?id=1" id="href2"><IMG id="Image1" height="79" width="80" border="0" name="Image1" src="button/mainbutton_1out.jpg"></A></TD>
<TD style="HEIGHT: 80px"><A onmouseover="MM_swapImage('Image2','','button/mainbutton_2up.jpg',1)" onmouseout="MM_swapImgRestore()" onmousedown="MM_goToURL('parent.frames[\'main\']','Content.aspx?tabindex=2&connum=0');return document.MM_returnValue" href="top.aspx?id=2" id="href3"><IMG id="Image2" height="79" width="80" border="0" name="Image2" src="button/mainbutton_2out.jpg"></A></TD>
<TD style="WIDTH: 96px;HEIGHT: 80px"><A onmouseover="MM_swapImage('Image3','','button/mainbutton_3up.jpg',1)" onmouseout="MM_swapImgRestore()" onmousedown="MM_goToURL('parent.frames[\'main\']','Content.aspx?tabindex=3&connum=0');return document.MM_returnValue" href="top.aspx?id=3" id="href4"><IMG id="Image3" height="79" width="80" border="0" name="Image3" src="button/mainbutton_3out.jpg"></A></TD>
<TD style="HEIGHT: 80px"><A onmouseover="MM_swapImage('Image4','','button/mainbutton_4up.jpg',1)" onmouseout="MM_swapImgRestore()" onmousedown="MM_goToURL('parent.frames[\'main\']','Content.aspx?tabindex=4&connum=0');return document.MM_returnValue" href="top.aspx?id=4" id="href5"><IMG id="Image4" height="79" width="80" border="0" name="Image4" src="button/mainbutton_4out.jpg"></A></TD>
<TD style="WIDTH: 20%;HEIGHT: 80px"><A onmouseover="MM_swapImage('Image6','','button/mainbutton_6up.jpg',1)" onmouseout="MM_swapImgRestore()" onmousedown="MM_goToURL('parent.frames[\'main\']','Content.aspx?tabindex=6&connum=0');return document.MM_returnValue" href="top.aspx?id=6" id="href7"><IMG id="Image6" height="79" src="button/mainbutton_6out.jpg" width="80" border="0" name="Image6"></A></TD>
<TD style="WIDTH: 20%;HEIGHT: 80px"></TD>
</TR>
</TABLE>
<TABLE id="Table2" style="HEIGHT: 26px" cellSpacing="0" cellPadding="0" width="100%" background="img/main_bar(2).gif" border="0">
<TR>
<!---->
<td width="120" style="HEIGHT: 1px">
<table cellpadding="0" cellspacing="0" border="0" width="150" height="18">
<TR>
<td onMouseUp="this.className='up'" onMouseDown="this.className='down'" onMouseOver="this.className='up'" title="Show/Hide" onMouseOut="this.className='m'" noWrap align="middle" width="100"><img id="pic" height="16" alt="Show/Hide Menu" hspace="4" src="img/hide_menu.gif" width="16" align="absMiddle" border="0"><span id="dir" onClick="cwin()">隐藏快捷栏</span></td>
<!----></TR>
</table>
</td>
<td width="50" align="middle" style="HEIGHT: 1px"><IMG alt="" src="img/icon_selectHand.gif">
</td>
<TD style="HEIGHT: 1px" align="left" valign="center">
<table style="WIDTH: 800px">
<asp:datalist id="dltTab" runat="server" RepeatDirection="Horizontal" Width="311px" Height="15px" ShowHeader="False" ShowFooter="False" BorderWidth="0px" CellPadding="0" GridLines="Horizontal" BorderStyle="Dotted" HorizontalAlign="Left">
<SelectedItemStyle BorderColor="Red"></SelectedItemStyle>
<SeparatorStyle Wrap="False" HorizontalAlign="Left" VerticalAlign="Middle"></SeparatorStyle>
<ItemStyle Font-Size="8pt" Wrap="False" HorizontalAlign="Left" VerticalAlign="Bottom"></ItemStyle>
<ItemTemplate>
<!-- -->
<a href="<%# DataBinder.Eval(Container.DataItem,"url")%>" target = 'main'>
<font size=2 ><%# DataBinder.Eval(Container.DataItem,"name") %></font>
</a>
</ItemTemplate>
<SeparatorTemplate>
<FONT face="宋体">|</FONT>
</SeparatorTemplate>
</asp:datalist>
</table>
</TD>
</TR>
</TABLE>
<SCRIPT language="javascript">
function cwin()
{if(parent.search.cols!='190,*')
{parent.search.cols='190,*';
document.all.pic.src ="img/hide_menu.gif";document.all.dir.innerHTML="隐藏快捷栏"}
else{parent.search.cols='0,*';
document.all.pic.src ="img/show_menu.gif";document.all.dir.innerHTML="显示快捷栏"}}
function MM_goToURL() { //v3.0
var i, args=MM_goToURL.arguments; document.MM_returnValue = false;
for (i=0; i<(args.length-1); i+=2) eval(args[i]+".location='"+args[i+1]+"'");
}
</SCRIPT>
</body>
</HTML>
后台
private void top1_Init(object sender, System.EventArgs e)
{
string ID = Request.QueryString["id"];
DataTable Tabs = (new CatalogsDB()).GetTab(ID);
int count=Tabs.Rows.Count;
dltTab.Width=count*50;
dltTab.DataSource = Tabs;
dltTab.DataBind();
}
CatalogsDB.cs
public class CatalogsDB
{
private string conStr ;
private SqlConnection con ;
private SqlDataAdapter commandAdp ;
public CatalogsDB()
{
conStr = System.Configuration.ConfigurationSettings.AppSettings.Get("ConnectionString");
con = new SqlConnection(conStr);
commandAdp = new SqlDataAdapter();
}
private string paramChg(string str)
{
str = "@"+str;
return str;
}

public DataTable GetTab(string tabid)
{
SqlDataAdapter Command = new SqlDataAdapter();
Command.SelectCommand = new SqlCommand();
DataSet ds_Tabs = new DataSet();
Command.SelectCommand.Connection = con;

Command.SelectCommand.CommandText ="GetsysTab";
Command.SelectCommand.CommandType = CommandType.StoredProcedure;

SqlParameter para_tabid = new SqlParameter("@tabid",SqlDbType.VarChar,20);
para_tabid.Value = tabid;
Command.SelectCommand.Parameters.Add(para_tabid);

Command.Fill(ds_Tabs,"thisTab");

return ds_Tabs.Tables["thisTab"];
}

public DataSet GetCatalogsData()
{
SqlCommand command = new SqlCommand();
command.CommandText = "select * from sysTab order by tabid";
command.Connection = con;

commandAdp.SelectCommand = command;

DataSet data = new DataSet();
commandAdp.Fill(data);

return data;
}
现在的问题是:点击Table1里面的ImageButton,不能显示出那个DataList。
...全文
59 1 打赏 收藏 转发到动态 举报
写回复
用AI写文章
1 条回复
切换为时间正序
请发表友善的回复…
发表回复
loveme4180 2006-04-26
  • 打赏
  • 举报
回复
贴出来之前应该整理一下,你这么多代码,而且很乱,会把人家吓跑的~~~~哈哈

62,046

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术交流专区
javascript云原生 企业社区
社区管理员
  • ASP.NET
  • .Net开发者社区
  • R小R
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

.NET 社区是一个围绕开源 .NET 的开放、热情、创新、包容的技术社区。社区致力于为广大 .NET 爱好者提供一个良好的知识共享、协同互助的 .NET 技术交流环境。我们尊重不同意见,支持健康理性的辩论和互动,反对歧视和攻击。

希望和大家一起共同营造一个活跃、友好的社区氛围。

试试用AI创作助手写篇文章吧