日期:2014-05-17 浏览次数:20640 次
<ItemTemplate> <%# Galsun.stgj.Bll.Shop.GetInfoByID(Convert.ToInt32(Eval("ShopID"))).Title%> </ItemTemplate> <EditItemTemplate> <asp:DropDownList ID="item_ddl_ShopID" runat="server"> </asp:DropDownList> <asp:HiddenField ID="item_hf_ShopID" Value=<%# Eval("ShopID") %> runat="server" /> </EditItemTemplate>
------解决方案--------------------
protected void dv1_RowDataBound(object sender, GridViewRowEventArgs e) { TextBox txt; TextBox txtSm; ImageButton Btn; if (e.Row.RowType == DataControlRowType.DataRow) { Btn = (ImageButton)e.Row.FindControl("btnDelete"); Btn.Attributes.Add("onclick", "return confirm('提示:\\n确定要删除吗?');"); txt = (TextBox)e.Row.FindControl("dqbh"); txt.Style.Add("ime-mode", "disabled");//当前文本框中文输入法控制。 txt.Attributes.Add("onkeyup", "with(window.event) if (event.keyCode == 13) return; this.value=this.value.replace(/[^0-9.]/gi,'');"); txtSm = (TextBox)e.Row.FindControl("sm"); txtSm.Style.Add("ime-mode", "disabled"); //声码文本的实例和其他的必须同时存在,所以名称不能相同 //增加事件,onkeydown,声码文本框的内容等于此文本框的pinyin,pinyin是自动获取 txt = (TextBox)e.Row.FindControl("dm"); txt.Attributes.Add("onkeydown", "with(window.event) if (keyCode==13){document.getElementById('" + txtSm.ClientID + "').value = pinyin.go(document.getElementById('" + txt.ClientID + "').value);}"); } else if (e.Row.RowType == DataControlRowType.Footer) { txt = (TextBox)e.Row.FindControl("dqbh1"); txt.Style.Add("ime-mode", "disabled"); txt.Attributes.Add("onkeyup", "with(window.event) if (event.keyCode == 13) return; this.value=this.value.replace(/[^0-9.]/gi,'');"); strControlClientID = txt.ClientID; PublicFunction.InitFocus(this, strControlClientID); txt = (TextBox)e.Row.FindControl("xian1"); Btn = (ImageButton)e.Row.FindControl("btnAdd"); txt.Attributes.Add("onkeydown", "with(window.event) if (keyCode==13){document.getElementById('" + Btn.ClientID + "').click();}"); txtSm = (TextBox)e.Row.FindControl("sm1"); txtSm.Style.Add("ime-mode", "disabled"); txt = (TextBox)e.Row.FindControl("dm1"); txt.Attributes.Add("onkeydown", "with(window.event) if (keyCode==13){document.getElementById('" + txtSm.ClientID + "').value = pinyin.go(document.getElementById('" + txt.ClientID + "').value);}");