I have a dictionary with a key value pair and need to loop through the pairs and create a button for each one and wire up the button to call a method DisplayDocument(string Id) and pass in the Key as a parameter.
Here's what I have so far.
// test data
var documents= new Dictionary<string,string>();
documents.Add("69110","Diploma");
documents.Add("76404", "Licensure");
foreach (KeyValuePair<string, string> item in documents)
{
MyStringBuilder=MyStringBuilder.Append(item.Value + " " + item.Key + "<br />");
}
printFaxDocuments.InnerHtml = MyStringBuilder.ToString();
What i want to do is print out the document Key and Value and then a button that the use can click to view the document. I have the method built to view the document and it requires the Key value to be passed in. How can I do this?
I'm not sure how to intersperse the button in the text data. I need to write out the key and value add the button add a "<br/>" and then do the same thing again for the next item in the dictionary.