Click here to Skip to main content
15,884,629 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
<asp:UpdatePanel ID="UpdatePanel6" runat="server">
<ContentTemplate>

<asp:Panel ID="Panel9" runat="server">
<table style="width: 100%;">
<tr>
<td class="auto-style1">ID</td>
<td class="auto-style1">:</td>
<td class="auto-style1">
<asp:TextBox ID="TxtPaymentVoucherID" runat="server" Enabled="False" Width="200px"></asp:TextBox>
</td>
</tr>
<tr>
<td class="auto-style1">Date</td>
<td class="auto-style1">:</td>
<td class="auto-style1">
<asp:TextBox ID="TxtPaymentDate" runat="server" Width="200px"></asp:TextBox>
<asp:ImageButton ID="ImageButton3" runat="server" ImageUrl="~/AdminImage/calendar.png" Height="25" Width="25" />
<cc1:CalendarExtender ID="CalendarExtender3" runat="server" TargetControlID="TxtPaymentDate" PopupButtonID="ImageButton3" />
</td>
</tr>

<tr>
<td>Category</td>
<td>:</td>
<td>
<asp:DropDownList ID="DdlCategory" runat="server" AutoPostBack="True" Width="200px" OnSelectedIndexChanged="DdlCategory_SelectedIndexChanged"></asp:DropDownList>
</td>
</tr>
<tr>
<td>Ledger
</td>
<td>:</td>
<td>
<asp:DropDownList ID="DblLedger" runat="server" AutoPostBack="True" Width="200px" OnSelectedIndexChanged="DblLedger_SelectedIndexChanged"></asp:DropDownList>
</td>
</tr>
<tr>
<td>Sub Ledger
</td>
<td>:</td>
<td>
<asp:DropDownList ID="DblSubLedger" runat="server" AutoPostBack="True" Width="200px"></asp:DropDownList>
</td>
</tr>
<tr>
<td>Type
</td>
<td>:</td>
<td>
<asp:DropDownList ID="DblType" runat="server" Width="200px">
<asp:ListItem>Bank</asp:ListItem>
<asp:ListItem Selected="True">Cash</asp:ListItem>
</asp:DropDownList>
</td>
</tr>
<tr>
<td>Amount
</td>
<td>:</td>
<td>
<asp:TextBox ID="TxtAmount" runat="server" Width="200px" OnTextChanged="TxtAmount_TextChanged" AutoPostBack="True"></asp:TextBox>
</td>
</tr>

<tr>
<td>In Word
</td>
<td>:</td>
<td>
<asp:TextBox ID="TxtInWord" runat="server" Width="100%"></asp:TextBox>
</td>
</tr>

<tr>
<td>Naration
</td>
<td>:</td>
<td>
<asp:TextBox ID="TxtNaration" runat="server" Width="100%" TextMode="MultiLine"></asp:TextBox>
</td>
</tr>

</table>
</asp:Panel>
<br />

<div style="overflow: scroll; height: 400px;">
<asp:GridView ID="GridView1" runat="server" Width="100%" AutoGenerateColumns="False" AutoGenerateSelectButton="True" OnSelectedIndexChanged="GridView1_SelectedIndexChanged">
<Columns>
<asp:BoundField DataField="ReceiptVchID" HeaderText="ID" SortExpression="ReceiptVchID" />
<asp:TemplateField HeaderText="Date" SortExpression="ReceiptVchDate">
<EditItemTemplate>
<asp:TextBox ID="TextBox1" runat="server" Text='<%# Bind("ReceiptVchDate") %>'></asp:TextBox>
</EditItemTemplate>
<ItemTemplate>
<asp:Label ID="Label1" runat="server" Width="70px" Text='<%# Bind("ReceiptVchDate", "{0:d}") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:BoundField DataField="Receipt_Catagory" HeaderText="Catagory" SortExpression="Receipt_Catagory" />
<asp:BoundField DataField="Receipt_Ledger" HeaderText="Ledger" SortExpression="Receipt_Ledger" />
<asp:BoundField DataField="Receipt_Sub_Ledger" HeaderText="Sub Ledger" SortExpression="Receipt_Sub_Ledger" />
<asp:BoundField DataField="ReceiptType" HeaderText="Receipt Type" SortExpression="ReceiptType" />
<asp:BoundField DataField="ReceiptAmount" HeaderText="Receipt Amount" SortExpression="ReceiptAmount" />
<asp:BoundField DataField="ReceiptInWord" HeaderText="Receipt In Word" SortExpression="ReceiptInWord" />
<asp:BoundField DataField="ReceiptNaration" HeaderText="Naration" SortExpression="ReceiptNaration" />
<asp:BoundField DataField="SaleMemoNo" HeaderText="Sale Memo No" SortExpression="SaleMemoNo" />
<asp:BoundField DataField="SaleRef" HeaderText="Sale Ref" SortExpression="SaleRef" />
<asp:BoundField DataField="Receipt_Option" HeaderText="Receipt Option" SortExpression="Receipt_Option" />

</Columns>
</asp:GridView>
</div>

</ContentTemplate>
</asp:UpdatePanel>


when I click on Gridview cell then Date textbox display none. How i can solve it?

What I have tried:

protected void GridView1_SelectedIndexChanged(object sender, EventArgs e)
{
TxtPaymentVoucherID.Text = GridView1.SelectedRow.Cells[1].Text.Replace(" ", "");
TxtPaymentDate.Text = GridView1.SelectedRow.Cells[2].Text.Replace(" ", "");
DdlCategory.SelectedItem.Text = GridView1.SelectedRow.Cells[3].Text.Replace(" ", "");
DblLedger.SelectedItem.Text = GridView1.SelectedRow.Cells[4].Text.Replace(" ", "");
DblSubLedger.SelectedItem.Text = GridView1.SelectedRow.Cells[5].Text.Replace(" ", "");
DblType.SelectedItem.Text = GridView1.SelectedRow.Cells[6].Text.Replace(" ", "");
TxtAmount.Text = GridView1.SelectedRow.Cells[7].Text.Replace(" ", "");
TxtInWord.Text = GridView1.SelectedRow.Cells[8].Text.Replace(" ", "");
TxtNaration.Text = GridView1.SelectedRow.Cells[9].Text.Replace(" ", "");
TxtMemoNo.Text = GridView1.SelectedRow.Cells[10].Text.Replace(" ", "");
TxtRefNo.Text = GridView1.SelectedRow.Cells[11].Text.Replace(" ", "");
RadioButtonList1.SelectedItem.Text = GridView1.SelectedRow.Cells[12].Text.Replace(" ", "");


}
Posted
Comments
Member 12893295 6-Jul-18 14:15pm    
You need to use the rowcommand or rowdatabound event for get the row values of gridview

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900