You need to sign in to do that
Don't have an account?

pagereference code for command button to go the page into detailed page,,???
public class apex4 {
public PageReference Save() {
return null;
}
contact con=new contact();
public contact newcon{get;set;}
public apex4(){
newcon=new contact();
}
public pagereference save(){
contact coninsert=new contact();
coninsert.lastname=newcon.name;
coninsert.phone=newcon.phone;
insert coninsert;
pagereference pageref = new pagereference('/'+con.id);
return pageref;
}
}
public PageReference Save() {
return null;
}
contact con=new contact();
public contact newcon{get;set;}
public apex4(){
newcon=new contact();
}
public pagereference save(){
contact coninsert=new contact();
coninsert.lastname=newcon.name;
coninsert.phone=newcon.phone;
insert coninsert;
pagereference pageref = new pagereference('/'+con.id);
return pageref;
}
}
Fitrst of all pagereference in always return pagereference not Null.
Try Below code:
Thanks
Vinod
Is it works?
If Yes then Mark my solution as the best answer. it will help others as well who face similar Issue.
Thanks
Vinod