gridview行索引删除按钮不起作用? [英] gridview row index delete button not working?

查看:72
本文介绍了gridview行索引删除按钮不起作用?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

在我的网站上面临一个问题。

它是由Asp.net用c#语言开发的

问题我提升你,

i无法删除我的gridview行值使用自动生成删除按钮。

它只发生在IE浏览器中

但我可以删除其他浏览器如chrome和firefox等...

请给我一个解决方案,这对我的未来很有帮助。



我的代码是:

 <   asp:GridView     ID   =  gvCLI    runat   = 服务器    AutoGenerateColumns   =  错误  

AllowPaging = True DataKeyNames = CLI onrowdeleting = delete CssClass = text1nowidth

< span class =code-attribute> 宽度 = 198px BorderColor = #8D6B09 BorderStyle = 实体 OnPageIndexChanging = gvCLI_PageIndexChanging >
< >
< ; asp:Bou ndField DataField = CLI HeaderText = 数字 >
< HeaderStyle BackColor = #8D6B09 ForeColor = < span class =code-keyword>白色 / >
< ; / asp:BoundField >
< asp:CommandField ShowDeleteButton = True >
< ControlStyle CssClass = text1nowidth / >
< HeaderStyle BackColor = #8D6B09 / >
< / asp:CommandField >
< /列 >
< / asp:GridView >







我的删除代码是:

 受保护  void  delete( object  sender,GridViewDeleteEventArgs e)
{

string dgoldcli = gvCL I.DataKeys [e.RowIndex] .Value.ToString();
// new cli is zero'因为我们要删除它,我们发送0

string [] result = new string [ 2 ];
// 我们在存储过程分配之前检查
// 如果CLI有效或无效,则无需在此处查看


clsCommon clsobj = new clsCommon();
result = clsobj.fnChangeTalkCLI(Session [ talkuser_id]。ToString(),dgoldcli , 0);


if (结果[ 0 ] == 1
{
/ / 已成功更改
lblStatus.Text = 数字未注册成功。;
// msg显示
string cliresult;
cliresult = clsobj.getTalkCli(会话[ talkuser_id]。ToString());
if (cliresult == 1
{
DataTable dt = clsobj.returnCLI();
gvCLI.DataSource = dt;
gvCLI.DataBind( );
}

else
{
lblStatus.Text = 您的注册号码列表为空;

}


}
else
{
// 错误消息
lblStatus.Text =结果[ 1 ];
}

string strscript = null ;
if (结果[ 0 ]!= 1
{
// 无法分配
strscript = < script language = JavaScript> + alert(\无法删除Number \)< / script> ;
if ((!ClientScript.IsStartupScriptRegistered( clientScript)))
{
ClientScript.RegisterStartupScript( this .GetType(), clientScript,strscript);
}
}
}



提前感谢..

解决方案

< blockquote>请参阅以下链接在gridview中自动删除

[ ^ ]






以下是您的问题的解决方案,您需要为您的应用程序设置借用者兼容性,只需尝试一下即可。它可能会工作。



http://browsercompatibility.codeplex.com/ [ ^ ]



问候,

Praveen Nelge


hi all,
am facing one issue on my website.
it was developed by Asp.net with c# language
the problem i rise you that,
i cant able to delete my gridview row value by using autogenerate delete button.
its only happen in the IE browser
but i can able to delete other browser like chrome and firefox etc...
please give me a solution for this, its very kind helpful for my future.

my code is:

<asp:GridView ID="gvCLI" runat="server" AutoGenerateColumns="False"

             AllowPaging="True" DataKeyNames="CLI" onrowdeleting="delete" CssClass="text1nowidth"

                      Width="198px" BorderColor="#8D6B09" BorderStyle="Solid" OnPageIndexChanging="gvCLI_PageIndexChanging">
            <Columns>
                <asp:BoundField DataField="CLI" HeaderText="Number" >
                    <HeaderStyle BackColor="#8D6B09" ForeColor="White" />
                </asp:BoundField>
                <asp:CommandField ShowDeleteButton="True" >
                    <ControlStyle CssClass="text1nowidth" />
                    <HeaderStyle BackColor="#8D6B09" />
                </asp:CommandField>
            </Columns>
        </asp:GridView>




my delete code is:

protected void delete(object sender, GridViewDeleteEventArgs e)
{
 
string dgoldcli = gvCLI.DataKeys[e.RowIndex].Value.ToString();
//new cli is zero 'since we want to delete it we send 0
 
string[] result = new string[2];
// we check before allocation at stored procedure
// if CLI is valid or not so no need to check here
 

clsCommon clsobj = new clsCommon();
result = clsobj.fnChangeTalkCLI(Session["talkuser_id"].ToString(), dgoldcli, "0");
 

if (result[0] == "1")
{
//successfully changed
lblStatus.Text = "Number unregistered successfully .";
//msg to display"
string cliresult;
cliresult = clsobj.getTalkCli(Session["talkuser_id"].ToString());
if (cliresult == "1")
{
DataTable dt = clsobj.returnCLI();
gvCLI.DataSource = dt;
gvCLI.DataBind();
}
 
else
{
lblStatus.Text = "Your registered numbers list is empty";

}
 

}
else
{
//error message
lblStatus.Text = result[1];
}
 
string strscript = null;
if (result[0] != "1")
{
//failed to alloc
strscript = "<script language=JavaScript>" + "alert(\"Cannot delete Number\")</script>";
if ((!ClientScript.IsStartupScriptRegistered("clientScript")))
{
ClientScript.RegisterStartupScript(this.GetType(), "clientScript", strscript);
}
}
}


thanks in advance..

解决方案

See the following linkauto delete in gridview
[^]


Hi,

Here is the solution for your problem, you need set borrower compatibility for your application, just try it out. It might work.

http://browsercompatibility.codeplex.com/[^]

Regards,
Praveen Nelge


这篇关于gridview行索引删除按钮不起作用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆