0
我在gridviewcolumn的footertemplate中有一個標籤。我想把這個標籤的計算值(總行數)放在javascript中。我可以訪問我的Itemtemplates中的所有文本框,但我不知道如何在我的foortertemplates中找到我的標籤。javascript中的gridview的footertemplate中的訪問標籤
的.aspx:列的GridView
<asp:TemplateField HeaderText="Prijs excl. BTW">
<ItemTemplate>
<asp:TextBox ID="txtBTWTarief" Width="60px" runat="server" Text='<%# Eval("exclBTW") %>' />
</ItemTemplate>
<FooterTemplate>
<asp:Label ID="lblTotexclBTW" runat="server" Text="0" Width="60px"></asp:Label>
</FooterTemplate>
</asp:TemplateField>
.aspx.cs:在動作事件處理
function updateValue(theGrid, rowIdx)
{
var ddl, t1, t2, l1, l2, l3, l4, k1;
ddl = document.getElementById(theGrid.rows[rowIdx].cells[2].children[0].id);
t1 = document.getElementById(theGrid.rows[rowIdx].cells[3].children[0].id);
//calculations...
}
在此:連接到我的文本框和DDL
protected void gridviewDiversen_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
string evtHandler;
int rowIndex = Convert.ToInt32(e.Row.DataItemIndex) + 1;
evtHandler = "updateValue(" + gridviewDiversen.ClientID + "," + rowIndex + ")";
((TextBox)e.Row.FindControl("txtBTWTarief")).Attributes.Add("onblur", evtHandler);
((TextBox)e.Row.FindControl("txtKorting")).Attributes.Add("onblur", evtHandler);
((DropDownList)e.Row.FindControl("ddlBTW")).Attributes.Add("onchange", evtHandler);
}
}
的JavaScript事件處理腳本我在Itemtemplate中找到我的文本框,但是我不知道如何在頁腳te中找到我的標籤mplate。任何人的想法? THX
THX,我用jQuery來填補在我的JavaScript的標籤。 – Ben 2010-10-22 15:31:02