Hi amitsinghr,
I have created sample code which full-fill your requirement .You need to modify as per your requirement.
HTML
<form id="form1" runat="server">
<div>
<div class="panel panel-default">
<div class="panel-heading main-color-bg">
<h3 class="panel-title">
Item Details
</h3>
</div>
<div class="panel-body">
<asp:Repeater ID="rptItemDetails" runat="server">
<HeaderTemplate>
<table class="table table-striped table-hover">
<tr>
<th>
Id
</th>
<th>
Item Name
</th>
<th>
Category Name
</th>
<th>
Description
</th>
<th>
Price
</th>
<td>
*
</td>
</tr>
</HeaderTemplate>
<ItemTemplate>
<tr>
<td>
<%#Eval("Id") %>
</td>
<td>
<%#Eval("ItemName") %>
</td>
<td>
<%#Eval("Value") %>
</td>
<td>
<%#Eval("Description") %>
</td>
<td>
<%#Eval("Price") %>
</td>
<td>
<asp:LinkButton ID="lnkBtn_Update" CssClass="btn btn-default" runat="server" data-toggle="modal"
aria-expanded="false" aria-controls="navbar" data-target="#addPage" CommandArgument='<%#Eval("Id") %>'>Update Item</asp:LinkButton>
</td>
<td>
<asp:Button ID="btnEdit" CommandArgument='<%#Eval("Id") %>' Text="Edit" OnClick="GetModelData"
CssClass="btn btn-info" runat="server" />
</td>
</tr>
</ItemTemplate>
<FooterTemplate>
</table>
</FooterTemplate>
</asp:Repeater>
</div>
</div>
<%-- Edit Item Model --%>
<!-- Modals -->
<!-- Add Page -->
<div class="modal fade" id="addPage" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span></button>
<h4 class="modal-title" style="text-align: center;" id="myModalLabel">
Add Item Details</h4>
</div>
<div class="modal-body">
<div class="form-group">
<label>
Add Category</label>
<input type="text" id="txt_AddCategory" runat="server" class="form-control" placeholder="Add Category"
validationgroup="vg_btn_AddCategoy" />
</div>
<div class="modal-footer">
<button type="button" id="btn_AddCategory" runat="server" class="btn btn-primary"
validationgroup="vg_btn_AddCategoy">
Add Category</button>
</div>
<h4 style="text-align: center;">
Add Item</h4>
<div class="form-group">
<label>
Category</label>
<asp:DropDownList ID="ddl_Category" CssClass="form-control" runat="server" ValidationGroup="vg_btn_AddItem">
</asp:DropDownList>
</div>
<div class="form-group">
<label>
Item Name</label>
<input type="text" id="txtItemName" runat="server" class="form-control" placeholder="Add Item Name..."
validationgroup="vg_btn_AddItem" />
</div>
<div class="form-group">
<label>
Description</label>
<input type="text" id="txt_Description" runat="server" class="form-control" placeholder="Add Description..."
validationgroup="vg_btn_AddItem" />
</div>
<div class="form-group">
<label>
Price</label>
<input type="text" id="txt_Price" runat="server" class="form-control" placeholder="Add Price..."
validationgroup="vg_btn_AddItem" />
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">
Close</button>
<button type="button" id="btn_AddItem" runat="server" class="btn btn-primary" validationgroup="vg_btn_AddItem">
Add Item</button>
</div>
</div>
</div>
</div>
</div>
<div>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<script type="text/javascript" src="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.2/js/bootstrap.min.js"></script>
<link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.2/css/bootstrap.min.css" />
<script type='text/javascript'>
function openModal() {
$('#addPage').modal('show');
}
</script>
</div>
</form>
C#
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
this.BindItemTable();
this.PopulateDropdownlist();
}
}
private void PopulateDropdownlist()
{
DataTable dt = new DataTable();
dt.Columns.Add("Id", typeof(int));
dt.Columns.Add("CategoryName");
dt.Rows.Add(1, "Product1");
dt.Rows.Add(2, "Product2");
dt.Rows.Add(3, "Product3");
dt.Rows.Add(4, "Product4");
dt.Rows.Add(5, "Product5");
ddl_Category.DataSource = dt;
ddl_Category.DataValueField = "Id";
ddl_Category.DataTextField = "CategoryName";
ddl_Category.DataBind();
ddl_Category.Items.Insert(0, new ListItem("SELECT", "0"));
}
private void BindItemTable()
{
DataTable dt = new DataTable();
dt.Columns.Add("Id", typeof(int));
dt.Columns.Add("ItemName", typeof(string));
dt.Columns.Add("Value", typeof(string));
dt.Columns.Add("Description", typeof(string));
dt.Columns.Add("Price", typeof(int));
dt.Rows.Add(1, "Crocine", "Product1", "Test", 2);
dt.Rows.Add(2, "Crocine1", "Product1", "Test", 6);
dt.Rows.Add(3, "Crocine2", "Product4", "Test", 7);
dt.Rows.Add(4, "Crocine3", "Product5", "Test", 23);
rptItemDetails.DataSource = dt;
rptItemDetails.DataBind();
ViewState["Data"] = dt;
}
protected void GetModelData(object sender, EventArgs e)
{
PopulateDropdownlist();
int id = int.Parse((sender as Button).CommandArgument);
DataTable dt = (DataTable)ViewState["Data"];
IEnumerable<DataRow> query = from j in dt.AsEnumerable()
where j.Field<int>("Id").Equals(id)
select j;
DataTable dtproudct = query.CopyToDataTable();
ddl_Category.Items.FindByText(dtproudct.Rows[0]["Value"].ToString()).Selected = true;
txtItemName.Value = dtproudct.Rows[0]["ItemName"].ToString();
txt_Price.Value = dtproudct.Rows[0]["Price"].ToString();
txt_Description.Value = dtproudct.Rows[0]["Description"].ToString();
ClientScript.RegisterStartupScript(this.GetType(), "Pop", "openModal();", true);
}
Vb.net
Protected Sub Page_Load(sender As Object, e As EventArgs)
If Not IsPostBack Then
Me.BindItemTable()
Me.PopulateDropdownlist()
End If
End Sub
Private Sub PopulateDropdownlist()
Dim dt As New DataTable()
dt.Columns.Add("Id", GetType(Integer))
dt.Columns.Add("CategoryName")
dt.Rows.Add(1, "Product1")
dt.Rows.Add(2, "Product2")
dt.Rows.Add(3, "Product3")
dt.Rows.Add(4, "Product4")
dt.Rows.Add(5, "Product5")
ddl_Category.DataSource = dt
ddl_Category.DataValueField = "Id"
ddl_Category.DataTextField = "CategoryName"
ddl_Category.DataBind()
ddl_Category.Items.Insert(0, New ListItem("SELECT", "0"))
End Sub
Private Sub BindItemTable()
Dim dt As New DataTable()
dt.Columns.Add("Id", GetType(Integer))
dt.Columns.Add("ItemName", GetType(String))
dt.Columns.Add("Value", GetType(String))
dt.Columns.Add("Description", GetType(String))
dt.Columns.Add("Price", GetType(Integer))
dt.Rows.Add(1, "Crocine", "Product1", "Test", 2)
dt.Rows.Add(2, "Crocine1", "Product1", "Test", 6)
dt.Rows.Add(3, "Crocine2", "Product4", "Test", 7)
dt.Rows.Add(4, "Crocine3", "Product5", "Test", 23)
rptItemDetails.DataSource = dt
rptItemDetails.DataBind()
ViewState("Data") = dt
End Sub
Protected Sub GetModelData(sender As Object, e As EventArgs)
PopulateDropdownlist()
Dim id As Integer = Integer.Parse(TryCast(sender, Button).CommandArgument)
Dim dt As DataTable = DirectCast(ViewState("Data"), DataTable)
Dim query As IEnumerable(Of DataRow) = From j In dt.AsEnumerable() Where j.Field(Of Integer)("Id").Equals(id)j
Dim dtproudct As DataTable = query.CopyToDataTable()
ddl_Category.Items.FindByText(dtproudct.Rows(0)("Value").ToString()).Selected = True
txtItemName.Value = dtproudct.Rows(0)("ItemName").ToString()
txt_Price.Value = dtproudct.Rows(0)("Price").ToString()
txt_Description.Value = dtproudct.Rows(0)("Description").ToString()
ClientScript.RegisterStartupScript(Me.[GetType](), "Pop", "openModal();", True)
End Sub
Screenshot