<asp:TextBox ID="txt_Numder" runat="server" Text='1'></asp:TextBox>
<asp:TextBox是放在repeater控件中的,所有的数据都是在 OnItemDataBound="Repeater1_ItemDataBound"进行查找显示,现在我想在txt_Numder中加个onfocus="editItem(1090,this);"事件,第一个参数为ID,要怎么才能把1090变成我通过OnItemDataBound="Repeater1_ItemDataBound"读出的ID值呢protected void Repeater1_ItemDataBound(object sender, RepeaterItemEventArgs e)
{
Label lbl_id = (Label)e.Item.FindControl("lbl_Cid");
string[] s = lbl_id.Text.Split('|');
//s[0].Tostring()
}
我想把上面的s[0].ToString(),写入aspx页的editItem()事件中,要怎么实现,由于数据是用itemdatabound来读取的,所以简单的用<%#Eval("proid")%>是无法实现的
<asp:TextBox是放在repeater控件中的,所有的数据都是在 OnItemDataBound="Repeater1_ItemDataBound"进行查找显示,现在我想在txt_Numder中加个onfocus="editItem(1090,this);"事件,第一个参数为ID,要怎么才能把1090变成我通过OnItemDataBound="Repeater1_ItemDataBound"读出的ID值呢protected void Repeater1_ItemDataBound(object sender, RepeaterItemEventArgs e)
{
Label lbl_id = (Label)e.Item.FindControl("lbl_Cid");
string[] s = lbl_id.Text.Split('|');
//s[0].Tostring()
}
我想把上面的s[0].ToString(),写入aspx页的editItem()事件中,要怎么实现,由于数据是用itemdatabound来读取的,所以简单的用<%#Eval("proid")%>是无法实现的
tb.Attributes.Add("onfocus",String.Format("editItem({0},this);",s[0].Tostring()));
TextBox tb=(TextBox )e.Item.FindControl("txt_Numder");
tb.Attributes.Add("onfocus",String.Format("editItem({0},this);",s[0].Tostring()));