I am trying to populate the contents of a List variable to a bootstrap modal. My problem is that the code only display the first element of the List variable.
This is my code:
List<string[]> listStatus = new List<string[]>();
for (int i = 0; i < listStatus.Count; i++)
{
for (int j = 0; j < 2; j++)
{
string body = listStatus[i][j+1].ToString();
body = body + " - " + listStatus[i][j].ToString();
ClientScript.RegisterStartupScript(this.GetType(), "Popup", "populateModal('" + body + "');", true);
}
}
ClientScript.RegisterStartupScript(this.GetType(), "Show", "showModal()", true);
Additional code:
protected void btnSplunk_Click(object sender, EventArgs e)
{
string sp_ip = "172.16.159.94";
int sp_port = 22;
string status = CheckCon(sp_ip, sp_port, lblSplunkUpdate);
listStatus.Add(new string[] { status, sp_ip });
}
protected void btnRandom_Click(object sender, EventArgs e)
{
string ran_ip = "134.32.233.21";
int ran_port = 801;
string status = CheckCon(ran_ip, ran_port, lblRnadomUpdate);
listStatus.Add(new string[] { status, ran_ip });
}
Could someone highlight what I'm doing wrong and point me in the right direction?