需求:我在RowCommand 中,
前台:
<ItemTemplate>
<asp:LinkButton ID="linkBtnEdit" runat="server" Text="编辑" CommandName="BtnEdit" CommandArgument='<%#Eval("Command") %>' OnClientClick="DivShow();">
<asp:LinkButton>
</ItemTemplate>
OnClientClick="DivShow()"是客户端,弹出JQuery的dialog
后台:protected void GDVYWInstruct_RowCommand(object sender, GridViewCommandEventArgs e)
{
///编辑
if (e.CommandName=="BtnEdit")
{
this.txtYWName.Text = "zhongkang";
this.txtCode.Text = "12222222";
}为什么this.txtYWName.Text = "zhongkang";
this.txtCode.Text = "12222222";
这些值在弹出的dialog中都不显示呢?
前台:
<ItemTemplate>
<asp:LinkButton ID="linkBtnEdit" runat="server" Text="编辑" CommandName="BtnEdit" CommandArgument='<%#Eval("Command") %>' OnClientClick="DivShow();">
<asp:LinkButton>
</ItemTemplate>
OnClientClick="DivShow()"是客户端,弹出JQuery的dialog
后台:protected void GDVYWInstruct_RowCommand(object sender, GridViewCommandEventArgs e)
{
///编辑
if (e.CommandName=="BtnEdit")
{
this.txtYWName.Text = "zhongkang";
this.txtCode.Text = "12222222";
}为什么this.txtYWName.Text = "zhongkang";
this.txtCode.Text = "12222222";
这些值在弹出的dialog中都不显示呢?
事件中动态调用DivShow()方法
alert("123");
$("#div1").dialog({
show: "explode", title: "添加业务指令", modal: true, width: 800, height: 300
});
$("#div1").parent().appendTo("#dialog_target");
}Jqeruy代码
{
///编辑
if (e.CommandName=="BtnEdit")
{
this.txtYWName.Text = "zhongkang";
this.txtCode.Text = "12222222";
if (!ClientScript.IsStartupScriptRegistered(this.GetType(), "showDiv"))
{
//最后一个参数是你要执行的js代码块或函数名称
ClientScript.RegisterStartupScript(this.GetType(), "showDiv", "DivShow()");
}
//...
}
对了,我的这个gridview中是放在 updatepanel 的无刷新控件中,应该把这个脚本修改一下把,否则不响应哦??
{
zh = "zhongkang"; if (!ClientScript.IsStartupScriptRegistered(this.GetType(), "showDiv"))
{
//最后一个参数是你要执行的js代码块或函数名称
// ClientScript.RegisterStartupScript(this.GetType(), "showDiv", "DivShow()"); ScriptManager.RegisterClientScriptBlock(this.Page, this.GetType(), "alert", "DivShow()", true); } this.txtYWName.Text = "zhongkang";
this.txtCode.Text = "12222222";这样好像也不能实现哦!跪求
把参数放到DivShow方法里,在js里进行赋值----jaysea,谢谢你的思路!