Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

passing a string parameter when calling a method in asp.net

Tags:

c#

asp.net

I have this method in cs page:

public String getToolTip(Object productId, Object imgBtnId)
{
    return UtilsStatic.getWishListButtonToolTip(Int32.Parse(productId.ToString()), getCumparaturiCategoryID(imgBtnId.ToString()));
}

and i want to call it from asp.net page (aspx).

I tried like this but it fails:

 ToolTip="<%# getToolTip(getProductIdNoutatiFeatured(), 'imgBtnWishSubcategory2Featured')%>"/>

Please note that the second parameter is an hardcoded string...but it says:

CS1012: Too many characters in character literal

I think it is wrong to put the string between ' '. But how?

like image 699
Cristian Boariu Avatar asked Jun 06 '26 18:06

Cristian Boariu


1 Answers

You can't use single quotes for a string, you have to reverse the usage of single- and double-quotes:

ToolTip='<%# getToolTip(getProductIdNoutatiFeatured(),
                        "imgBtnWishSubcategory2Featured")%>'/>
like image 149
M4N Avatar answered Jun 09 '26 08:06

M4N