日期:2014-05-17 浏览次数:20549 次
<script language="javascript" type="text/javascript"> function ManageSoundControl(action) { var soundControl = document.getElementById("soundControl"); if(action == "play") { soundControl.play(); } if(action == "stop") { soundControl.stop(); } } </script> <embed id="soundControl" src="upfiles/263508.mp3" loop=false autostart=false width=10 height=10></embed> <input id="btPlay" type="button" value="播放" onclick="ManageSoundControl('play')" /> <input id="btStop" type="button" value="停止" onclick="ManageSoundControl('stop')" />
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" CellPadding="4" ForeColor="#333333" GridLines="None" > <Columns> <asp:TemplateField HeaderText="图标"> <ItemTemplate> <embed id="soundControl" src="upfiles/<%#DataBinder.Eval(Container.DataItem,"soundName")%>" loop=false autostart=false width=10 height=10></embed> </ItemTemplate> </asp:TemplateField> <asp:TemplateField HeaderText="播放" > <ItemStyle Wrap="False" Width="150px" /> <ItemTemplate> <input id="btPlay" type="button" value="播放" onclick="ManageSoundControl('play')" /> <input id="btStop" type="button" value="停止" onclick="ManageSoundControl('stop')" /> </ItemTemplate> </asp:TemplateField> <asp:TemplateField HeaderText="录音文件"> <ItemStyle Wrap="False" Width="150px" /> <ItemTemplate> <asp:Label ID="lblname" Width="150px" runat="server" Text='<%# Bind("soundName") %>'></asp:Label> </ItemTemplate> </asp:TemplateField> </Columns> </asp:GridView>
public string soundName = ""; protected void Page_Load(object sender, EventArgs e) { DbCommand db_src = db.GetSqlStringCommand("select soundName,tid from test"); db.ExecuteNonQuery(db_src); GridView1.DataSource = db.ExecuteDataSet(db_src).Tables[0]; GridView1.DataBind(); }
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" CellPadding="4" ForeColor=