asp.net mvc - using model value in MVC codescope -
i trying model value in mvc codescope-
@model funranger.models.cardmodel @{ viewbag.title = "carddetails"; layout = "~/views/shared/_layout.cshtml"; var link = string.format( "'http://www.facebook.com/sharer.php?u='+'http://funranger.com/home/carddetails/?cardid'+'@model.cardid", url.encode("http://funranger.com/home/carddetails/?cardid=@model.cardid/"), url.encode("this site") ); }
here can see trying model value in var link
, sharing on facebook. here in codescope want @model.cardid
's value.
how model value?
for example url like- http://funranger.com/home/carddetails/?cardid=178
edit-
string encodedurl = string.format("http://funranger.com/home/carddetails/?cardid={0}", model.cardid); string link = string.format("http://www.facebook.com/sharer.php?u={0}", url.encode(encodedurl));
it shared on website encodeurl
path.
facebook sharing shows this-
it seems sharing image.
i sharing below-
<a href="@link">share in facebook</a>
for example url like- http://funranger.com/home/carddetails/?cardid=178
you can -
@{ string encodedurl = string.format("http://funranger.com/home/carddetails/?cardid={0}/",model.cardid); string link = string.format("http://www.facebook.com/sharer.php?u={0}", url.encode(encodedurl)); }
output -
between confused usage of string.format(), have not mentioned placeholders in string.format() implmentation.
also not sure url.encode("this site")
Comments
Post a Comment