my requirement is when i click on lbkbtn i need to show a modal popup In that modal popup i have a dropdown and a textbox i need to bind datafield value of settlementcycle to the dropdown that was inside my modal ddlcycle and perlimit transaction field value to the txtTperlimit inside that modal i am unable to do it can u pls fix me out this issue.. My Gridview
<asp:GridView ID="GrdVsettleRecords" runat="server" HeaderStyle-BackColor="#5d6dc3" class="table table-bordered table-hover dataTable" AutoGenerateColumns="False" AllowPaging="false" CellPadding="3" EnableViewState="false"> <PagerStyle CssClass="gridview" BackColor="White" ForeColor="#000066" HorizontalAlign="Left" /> <FooterStyle BackColor="White" ForeColor="#000066" /> <HeaderStyle BackColor="#006699" Font-Bold="True" ForeColor="White" /> <PagerSettings FirstPageText="<" LastPageText=">" PageButtonCount="4" /> <Columns> <asp:BoundField DataField="SrNo" HeaderText="Sr No" /> <asp:BoundField DataField="ServiceType" HeaderText="ServiceType" /> <asp:BoundField DataField="ProductType" HeaderText="ProductType" /> <asp:BoundField DataField="APIPartnerName" HeaderText="APIPartnerName" /> <asp:BoundField DataField="SettlementCycle" HeaderText="Settlement Cycle" /> <asp:BoundField DataField="PerTransactionLimit" HeaderText="PerTransactionLimit" /> <asp:TemplateField HeaderText="Action"> <ItemTemplate> <asp:LinkButton ID="lnkbtn" CommandArgument='<%#Bind("SrNo") %>' runat="server" class="fa fa-pencil" OnClick="lnkbtn_Click"></asp:LinkButton> </ItemTemplate> </asp:TemplateField> </Columns> <RowStyle ForeColor="#000066" /> <SelectedRowStyle BackColor="#669999" Font-Bold="True" ForeColor="White" /> </asp:GridView>
Code Behind
protected void lnkbtn_Click(object sender, EventArgs e) { try { LinkButton lnkbtn = sender as LinkButton; GridViewRow row = lnkbtn.NamingContainer as GridViewRow; if (row != null) { int index = row.RowIndex; if (index >= 0 && index < GrdVsettleRecords.Rows.Count) { string settlementCycleValue = GrdVsettleRecords.Rows[index].Cells[4].Text; string perTransactionLimit = GrdVsettleRecords.Rows[index].Cells[5].Text; if (settlementCycleValue == "Instant") { ddlCycle.SelectedIndex = 0; } if (settlementCycleValue == "Manual") { ddlCycle.SelectedIndex = 1; } txtTPerLinit.Text = perTransactionLimit; ScriptManager.RegisterStartupScript(UPDP_Settlements, UPDP_Settlements.GetType(), "ShowEditModal", "ShowEditModal();", true); } } } catch (Exception exception) { ScriptManager.RegisterStartupScript(UPDP_Settlements, UPDP_Settlements.GetType(), "ErrorMsg", "<script>alert('" + exception.Message.ToString() + "')</script>", true); } catch (Exception ex) { oExceptionManager.LogError(ex.Message, " -- In btnEdit_Click Function Settlements.aspx.cs"); throw new Exception(); } }
my Modal
<div class="modal fade" id="ViewDocumentmodal" role="dialog" > <div class="modal-dialog"> <!-- Modal content--> <div class="modal-content"> <div class="modal-header"> <button type="button" class="close" onclick="CloseModalPopup();">×</button> <h4 class="modal-title" id="username_changeSlab" runat="server"></h4> </div> <div class="modal-body"> <div class="form-group col-xs-5" style="margin-top:7px"> <asp:Label ID="lblDDL" runat="server" Text="SettlementCycle:" ></asp:Label> </div> <div class="form-group col-xs-6"> <asp:DropDownList ID="ddlCycle" runat="server" class="form-control" AutoPostBack="false"> <asp:ListItem Text="Instant" Value="1"></asp:ListItem> <asp:ListItem Text="Manual" Value="2"></asp:ListItem> </asp:DropDownList> </div> <div class="form-group col-xs-5" style="margin-top:7px"> <asp:Label ID="lblTxt" runat="server" Text="PerTransactionLimit:"></asp:Label> </div> <div class="form-group col-xs-6"> <asp:TextBox ID="txtTPerLinit" runat="server" class="form-control" onkeypress="return isDecimal(event);"></asp:TextBox> </div> <div> <asp:Button ID="btnS" class="btn btn-primary" runat="server" Text="Save" /></div> </div> </div> <div class="modal-footer"> </div> </div> </div>