请大家指点下!
我现在在Datalist的模板列中使用一个HTML的按钮,通过这个按钮调用脚本往数据库中插入数据。现在我不知道如何获取当前记录行的索引ID。因为我这里需要根据索引ID来插入数据。
aspx页面
<script language= "javascript " type= "text/javascript ">
<!--
function yy()
{
var BlogName= document.getElementById( "Text4 ").value;
var BlogHtml= document.getElementById( "Text5 ").value;
var BolgSignature= document.getElementById( "Text6 ").value;
var AssociatorID= document.getElementById( "Text7 ").value;
var ChickNumber= document.getElementById( "Text1 ").value;
alert(BlogTest.TestSql(BlogName,BlogHtml,BolgSignature,AssociatorID,ChickNumber).value);
}
function tt(obj)
{
var a1=obj.nextSibling.nextSibling;
if(a1.style.display == "none ")
a1.style.display= "block ";
else
a1.style.display = "none ";
}
<asp:DataList ID= "DataList1 " runat= "server " DataKeyField= "BlogID " OnSelectedIndexChanged= "DataList1_SelectedIndexChanged ">
<ItemTemplate>
<hr size = "1 " />
<asp:TextBox ID= "text " runat= "server " Text= ' <%# Eval( "DiaryContents ") %> ' TextMode= "MultiLine " Width= "225px "> </asp:TextBox>
浏览数: <asp:Label ID= "Label8 " runat= "server " Text= ' <%# Eval( "ChickNumber ") %> ' />
回复数: <asp:Label ID= "Label10 " runat= "server " Text= ' <%# Eval( "CommentNumber ") %> '/> <br />
发表日期: <asp:Label ID= "Label9 " runat= "server " Text= ' <%# Eval( "DiaryDate "