property in my mainClass
public Int64 DetailID
{
get { return bintDetailID; }
set { bintDetailID = value; }
}
myClass
mainClass obj=new mainClass();
obj.DetailID = int.Parse(e.CommandArgument.ToString());
aspx page
<asp:Button ID="btnEdit" Text="Edit" CommandArgument='<%#Eval("DetailID") %>'
CausesValidation="false" CommandName="Edit" Visible="false" runat="server" OnCommand="btnEdit_Click"/>
Isn’t this how u convert string to int ?
int.Parse(e.CommandArgument.ToString());
Whats wrong ? plz help..thnx
Assuming that your Button object is NOT within a databound control like a grid / repeater,
AND If you are trying to Bind the button using the DetailID property, check the following:-
Assuming your button is in
testPage.aspx, the codebehind class fortestPage.aspxi.eclass testPageshould have a property of typeInt64called DetailID.eg :
Int64 DetailID get; set;Assuming mainClass is some custom class of yours, somewhere in Page_Load, you will have to do a
this.DetailID = mainClassObject.DetailID;wherethis= instance of your page.In your
page_loadmethod, additionally, you will have to do aPage.DataBind(). This is because a non-databound control like button does not have its own DataBind() method.Note 1: If your testPage.DetailID = Int32 / int, you will need to do the conversion in the setter method or before that as y0ur mainClass is an Int64
Note 2: From your comments, you seem to be saying that Int64 doesnt exist. Which is weird!
Try using the fully qualified name i.e System.Int64 and see if that works!