I'm trying to load specific data from my api into datagrid. I make requests for specific Id, and the results should be appear in data grid
Here's my code behind :
private async void btnSearch_Click(object sender, RoutedEventArgs e)
{
using (WebClient client = new WebClient())
{
try
{
string url = string.Format("https://localhost:44324/api/Channels/{0}", idtxt.Text);
var json = client.DownloadString(url);
Channelindex info = JsonConvert.DeserializeObject<Channelindex>(json);
txtName.Text = info.name;
txturl.Text=info.url;
Usergrid. Itemsource=info.url;
MessageBox.Show("User Found : " + info.name + " " + info.url);
}
catch (Exception ex)
{
MessageBox.Show("Unable To Locate ID: " + ex.Message, "Exception Sample", MessageBoxButton.OK, MessageBoxImage.Error);
}
}
}
But my datagrid fails. I'd appreciate if you help me Thanks.