Hi
I have below code & i want when clicked on Add modal popup opens & in Dropdown i want to display States of selected record in a dropdown
try
{
StringBuilder htmlTable = new StringBuilder();
string ParticipantType = "";
BALTrainingHeader bALTrainingHeader = new BALTrainingHeader();
List<TrainingHeader> Result = bALTrainingHeader.GetRecordListDrafted();
if (Result != null)
{
BALEmployee bALEmployee = new BALEmployee();
htmlTable.Append("<table class='table table-bordered table-hover datatable-highlight' id='tbldata'>");
htmlTable.Append("<thead><tr><th style='display:none'>#</th><th>Training Number</th><th class='text-center nosort'>Add</th></tr></thead>");
htmlTable.Append("<tbody>");
foreach (var colum in Result)
{
htmlTable.Append("<tr>");
htmlTable.Append("<td style='display:none'>" + colum.TrainingID + "</td>");
htmlTable.Append("<td>" + colum.TrainingNumber + "</td>");
htmlTable.Append("<td class='text-center'> <a id='btnAdd' style='cursor:pointer;' class='list-icons-item text-primary-600' data-toggle='modal' data-backdrop='static' data-keyboard='false' data-target='#modal_form_horizontal' onclick='BindData(this);'><i class='icon-pencil7 mr-1'></i></a></td>");
htmlTable.Append("</tr>");
}
htmlTable.Append("</tbody>");
htmlTable.Append("</table>");
PlaceHolderTable.Controls.Add(new Literal { Text = htmlTable.ToString() });
}
}
<div id="modal_form_horizontal" class="modal fade">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header bg-info">
<h5 class="modal-title">Add/Update Record</h5>
<button type="button" class="close" data-dismiss="modal">×</button>
</div>
<div class="form-horizontal">
<div class="modal-body">
<div class="row">
<div class="col-lg-6">
<div class="form-group">
<label>State</label> <span style="color: red">*</span>
<asp:DropDownList ID="ddlState" class="form-control" runat="server" required="true">
<asp:ListItem Value="">Select State</asp:ListItem>
</asp:DropDownList>
</div>
</div>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-link" data-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>
</div>
Thanks