pand_r
شنبه 21 اسفند 1389, 10:20 صبح
سلام
میخواستم وقتی روی دکمه حذف رکورد موجود در gridview میزنم یک confirmation که با jquery درست کردم باز بشه و وقتی ok کرد رویداد کلیک دکمه حذف صدا زده بشه و رکورد مورد نظرم حذف بشه؟ چطور میتونم رویداد کلیک که سمت سرور را توی jquery صدا بزنم؟
خودم اینجوری نوشتم ولی رویداد کلیک نمیشه static تعریف کرد:
کد jquery دکمه yes:
$('.yes').bind('click', function(){
$.ajax({
type: "POST",
cache: false,
url: "contactmsg.aspx/del",
contentType: "application/json; charset=utf-8",
data: "{}",
dataType: "json",
async: false,
timeout: 1000,
error: function() {
alert('do not support ajax');
},
success: function(msg) {
// Replace the div's content with the page method's return.
$("#Result").text(msg.d);
}
});
});
رویداد کلیک دکمه:
[WebMethod]
protected void imgb_del_Click(object sender, ImageClickEventArgs e)
{
ImageButton img = (ImageButton)sender;
GridViewRow selectrow = (GridViewRow)img.Parent.Parent;
strcode = ((Label)GridView1.Rows[selectrow.RowIndex].FindControl("lcode")).Text;
کد حذف رکورد...
databind();
}
میخواستم وقتی روی دکمه حذف رکورد موجود در gridview میزنم یک confirmation که با jquery درست کردم باز بشه و وقتی ok کرد رویداد کلیک دکمه حذف صدا زده بشه و رکورد مورد نظرم حذف بشه؟ چطور میتونم رویداد کلیک که سمت سرور را توی jquery صدا بزنم؟
خودم اینجوری نوشتم ولی رویداد کلیک نمیشه static تعریف کرد:
کد jquery دکمه yes:
$('.yes').bind('click', function(){
$.ajax({
type: "POST",
cache: false,
url: "contactmsg.aspx/del",
contentType: "application/json; charset=utf-8",
data: "{}",
dataType: "json",
async: false,
timeout: 1000,
error: function() {
alert('do not support ajax');
},
success: function(msg) {
// Replace the div's content with the page method's return.
$("#Result").text(msg.d);
}
});
});
رویداد کلیک دکمه:
[WebMethod]
protected void imgb_del_Click(object sender, ImageClickEventArgs e)
{
ImageButton img = (ImageButton)sender;
GridViewRow selectrow = (GridViewRow)img.Parent.Parent;
strcode = ((Label)GridView1.Rows[selectrow.RowIndex].FindControl("lcode")).Text;
کد حذف رکورد...
databind();
}