在列表视图中删除和更新. [英] deleting and updating in listview.

查看:81
本文介绍了在列表视图中删除和更新.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,我正在删除用户个人资料并更新他的状态(有效或无效).由于功能上的变化,我现在已经在gridview,bt中完成了所有操作,而我必须在listview中进行此操作.
这是我的代码

hi guys, i am working on the deletion of users profile and updation of his status(active or deative). i have done all this in gridview, bt now because of change in functionality i have to do this in listview .
this is my code

protected void GrdJsAllProfileDetail_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        try
        {
            DataRowView dRowView = (DataRowView)e.Row.DataItem;
            if (e.Row.RowType == DataControlRowType.DataRow)
            {
                                ImageButton imgactivedeactive = (ImageButton)e.Row.FindControl("imgactivedeactive");
                imgactivedeactive.CommandName = dRowView["ProfileId"].ToString();
                if (dRowView["JSStatus"].ToString() == "True")
                {
                                          imgactivedeactive.ImageUrl = "..\\Images\\active.png";
                    imgactivedeactive.CommandArgument = "False";
                }
                else
                {
                    imgactivedeactive.ImageUrl = "..\\Images\\deactive.png";
                    imgactivedeactive.CommandArgument = "True";
                }
            }
        }
        catch (Exception ex)
        {
        }
    }





protected void GrdJsAllProfileDetail_RowCommand(object sender, GridViewCommandEventArgs e)
{
    try
    {
        jsRegister.IntJobseekerid = Convert.ToInt32(Session["JobSeekerId"]);
        jsRegister.ProfileId = Convert.ToInt32(e.CommandName);
        jsRegister.ISPROFILESTATUS = Convert.ToBoolean(e.CommandArgument);
        jsRegister.Update_JobSeeker_Profile_Status();
        DisplayAllJobSeekerProfile();

    }
    catch (Exception ex)
    {
    }
}


        protected void GrdJsAllProfileDetail_RowDeleting(object sender, GridViewDeleteEventArgs e)
        {

            // SQL Delete Command
            
            GridViewRow row = (GridViewRow)GrdJsAllProfileDetail.Rows[e.RowIndex];
            ImageButton lndlt = (ImageButton)row.FindControl("imgactivedeactive");
            if (lndlt.ImageUrl == "..\\Images\\deactive.png")
            {
                Label lbldeleteID = (Label)row.FindControl("lblProfileId");

                jsRegister.ProfileId = Convert.ToInt32(lbldeleteID.Text);
                jsRegister.Delete_JSApplyJob();
                jsRegister.Delete_JSProfile();
                DisplayAllJobSeekerProfile();

            }
            else
            {


                string strjscript = "alert(''Sorry, You can''t Delete An Active Profile'');";
ScriptManager.RegisterStartupScript(this, this.GetType(), "RedirectScript", strjscript, true);
return;

}
        } 


您能告诉我列表视图的哪些事件与该代码中使用的网格视图事件相同.

大家好,谢谢大家.


can you please tell me which events of listview works same like grid views event used in this code .

thanks a lot in advance guys

推荐答案

两者都有共同的属性,事件还有数据操作,排序等,因此您可以轻松地转换代码,只需花点时间给自己计时.

查看 GridView类 [ ^ ]& ListView类 [ ^ ]在MSDN
Gridview与ListView [将ListView与GridView,DataList和Repeater进行比较 [
Both has common properties, events also the data operation, sorting, etc., So you can convert the code easily, just spend the time yourself.

Look at the GridView Class[^] & ListView Class[^] at MSDN
Gridview Vs ListView[^]
Comparing ListView with GridView,DataList and Repeater [^]


这篇关于在列表视图中删除和更新.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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