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-

enter image description here

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 -

enter image description here

between confused usage of string.format(), have not mentioned placeholders in string.format() implmentation.

also not sure url.encode("this site")


Comments

Popular posts from this blog

python - Subclassed QStyledItemDelegate ignores Stylesheet -

java - HttpClient 3.1 Connection pooling vs HttpClient 4.3.2 -

SQL: Divide the sum of values in one table with the count of rows in another -