如何从服务器端获取删除按钮 [英] How to get delete button working from server side

查看:84
本文介绍了如何从服务器端获取删除按钮的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,



好​​的,我的页面上有一个按钮,当我点击它时,我需要它从SQL Developer中的表中删除一行。 />


MY按钮创建时带有表服务器端和点击事件..

Hi All,

Ok i have a button on my page that when clicked on i need it to delete a row from a table in SQL Developer.

MY button is created with a table server side with an on click event..

bt2 = New HtmlGenericControl("div")
                bt2.InnerHtml = "<input type=button onclick=deleteUser('" & dt.Item("login_id").ToString & "') value='Delete User'>"





我需要帮助,为它编写一个javascript函数,当按下警告时出现询问你确定要删除,如果是,则删除用户,如果没有消息消失。



i有这个功能但我不确定我需要写什么服务器端来从数据库中删除按钮。





I need help with writing a javascript function for it that when pressed an alert with come up asking are you sure you want to delete and if yes the user is deleted and if no the message disappears.

i have this function but i am unsure of what i need to write server side to make the button delete from database.

function deleteUser(delUserid) {

        if (confirm("Are you sure you want to delete? This action cannot be undone.")){

            var link = 'DeleteUser.aspx?userid' + delUserid

            $.get(link, function (data) {

            });

        }

        else{ return false;
        }


       
    }







我试过这个服务器端,但似乎没有工作






I have tried this server side but doesnt seem to work

If Request.QueryString("userid") <> "" Then

           Dim delResult As dataset
           Dim dt As DataTableReader

           delResult = GetUserName.deleteUser(Request.QueryString("userid").ToString)
           dt = delResult.CreateDataReader


       End If









谢谢





Thank you

推荐答案

get (link,function(data){

});

}

其他 {返回 ;
}



}
.get(link, function (data) { }); } else{ return false; } }







我试过这个服务器端,但似乎没有工作






I have tried this server side but doesnt seem to work

If Request.QueryString("userid") <> "" Then

           Dim delResult As dataset
           Dim dt As DataTableReader

           delResult = GetUserName.deleteUser(Request.QueryString("userid").ToString)
           dt = delResult.CreateDataReader


       End If









谢谢





Thank you


我设法找到解决问题的方法。



基本上按钮会显示警告,说明你确定要删除,但如果我按下我肯定不会发生任何事情。



我是什么失踪是一个链接n删除按钮的功能和删除用户的sql函数。



我必须创建另一个页面来添加将按钮链接到的服务器端代码SQL



代码已添加到新页面..



I managed to find a solution to my problem.

Basically the button would poop up with an alert stating are you sure you want to delete but nothing would happen if i pressed i am sure.

What i was missing was a link between the function for the delete button and the sql function to delete the user.

I had to create another page to add the server side code that links the button to the SQL

code added to new page..

Protected Sub Page_Load(sender As Object, e As EventArgs) Handles Me.Load

    If Request.QueryString("userid") <> "" Then

        Dim delResult As New DataSet
        Dim dt As DataTableReader

        delResult = GetUserName.deleteUser(Request.QueryString("userid").ToString)
        dt = delResult.CreateDataReader



    End If


End Sub


这篇关于如何从服务器端获取删除按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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