I have a problem I have JSON data in my aspx page.Also I have code inside code behind to call api to get all JSON data. My sample json data as followsenter
"tags": "খালেদা-জিয়া,বিএনপি,নির্বাচন",
"timeline_tags": null,
"people_tags": null,
Here you can see in tags there are more than 1 value. I want display the first value .In my aspx I take inside a tag as follows
`enter code here`<a href="/TagNews.aspx?tagname=<%#Eval("tags")%>" class="tags">
Here in #EVAL i get all value i need to get the first one.Your help will be highly appreciated.Thanks
You can split the string and use just the first returned element:
<%#((string)Eval("tags")).Split(new string[] {","}, StringSplitOptions.None)[0]%>