Help on grid view row command

Posted by Vijayar under C# on 7/20/2011 | Points: 10 | Views : 1745 | Status : [Member] | Replies : 1
I have 3 command names i.e update,delete and view for a gridview.I have palced the 3 buttons in item template, and row the code as

protected void gvuniversity_RowCommand(object sender, GridViewCommandEventArgs e)
{
if (e.CommandName == "MyEdit")
{
int universityid = Convert.ToInt32(e.CommandArgument);
ViewState["sourceid"] = universityid;
hiddenSource.Value = Convert.ToString(e.CommandArgument);
showallsave1.CommandName = "update";
oNewUniversitiesBO = new NewUniversitiesBO();
try
{


ModalPopupExtender2.Show();
}

catch (Exception ex)
{
ex.Message.ToString();
}
}


else if (e.CommandName == "View")
{
int universityid = Convert.ToInt32(e.CommandArgument);
NewUniversitiesBO oNewUnversitiesBO = new NewUniversitiesBO();
try
{
NewUniversitiesEn oNewUniversitiesEN = new NewUniversitiesEn();

ModalPopupExtender1.Show();
}

catch (Exception ex)
{
ex.Message.ToString();
}
}
else if(e.CommandName == "Delete")
{
int universityID = Convert.ToInt32(e.CommandArgument);

try
{

NewUniversitiesEn oNewUniversitiesEN = new NewUniversitiesEn();
oNewUniversitiesEN.UniversityId = Convert.ToInt32(universityID);
bool result;
result = oNewUniversitiesBO.Delete(oNewUniversitiesEN);
if (result == true)
{
this.ClientScript.RegisterStartupScript(this.GetType(), "Message", "<script language=\"javaScript\">" + "alert('Record Deleted Succesfully...');" + "<" + "/script>");
//lblmsg.ForeColor = System.Drawing.Color.Green;
//lblmsg.Text = "Sucessfully Deleted";
}
BindData();
}




catch (Exception ex)
{
ex.Message.ToString();
}
}

}

But i am not getting result what to do know

vijaya


Responses

Posted by: Jpchoudhari on: 7/20/2011 [Member] Starter | Points: 25

Up
0
Down
Hi,

Please specify your requirement clearly; as what result you are not able to get.

suggestion: try to bind the grid view for every row command to get the results.(In case if you are not getting the ModalPopupExtender)

Kind Regards,
Jay

Vijayar, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response