asp textbox not work with collapsed column on datatable
asp textbox not work with collapsed column on datatable
Hy to all
.. when i try to get via code the value of a input asp textbox it doesn't contain the right value. It return a sort of concatenation of the old and new value with comma. (Example if the initial value was "1,00" and i fill "3" then when i hit btnGetVal on server side i get "1,00,3"...)
i have a table in this asp page
<asp:UpdatePanel runat="server">
<ContentTemplate>
<asp:HiddenField ClientIDMode="Static" ID="id_p" runat="server" />
<table id="Gridv" class="responsive table table-striped table-bordered table-hover table-fixed-row" style="width: 100%">
<thead>
<tr>
<th>D1</th>
<th>D2</th>
<th>Desc.</th>
<th>Qta</th>
<th>Pr.</th>
<th></th>
<th class="none"></th>
<th style="display: none"></th>
</tr>
</thead>
<tbody>
<asp:Repeater ID="repGrid" runat="server">
<ItemTemplate>
<tr>
<td><%# Eval("desc_1") %></td>
<td><%# Eval("desc_2") %></td>
<td><%# Eval("desc_aaa") %></td>
<td><%# String.Format("{0:N2}", Eval("qta") ) %></td>
<td>€ <%# String.Format("{0:N2}", Eval("prz") ) %></td>
<td></td>
<td>
<div class="row no-gutters p-0 m-0">
<div class="col-1">
<label class="col-form-label">Qta</label>
</div>
<div class="col-2">
<input runat='server' id='qta' type='number' style='visibility: visible' value='<%# String.Format("{0:N0}", Eval("qta") ) %>' step="1" min="0.00" max="99990.00" onclick="this.select();" class="form-control" />
</div><div class="col-2">
<asp:TextBox ID="txtCell_Qta" vold=<%# String.Format("{0:N2}", Eval("qta") ) %> CssClass="form-control" runat="server" Text=<%# String.Format("{0:N2}", Eval("qta") ) %> ></asp:TextBox>
</div>
<div class="col-5">
<asp:Button runat="server" ID="btnGetVal" OnClientClick=<%# "$('#id_p').val('"+ Eval("id_k") +"');"%> val='<%#Eval("id_k")%>' class="btn btn-outline-success" Text="Salva" OnClick="btnGetVal_Click" />
</div>
</div>
</td>
<td id="val_k" runat="server" style="display: none"><%# Eval("id_k") %></td>
</tr>
</ItemTemplate>
</asp:Repeater>
</tbody>
</table>
</ContentTemplate>
</asp:UpdatePanel>
code behind on server side when btnGetVal is fired i just want to get the data filled in the asp input txtCell_Qta.
```
protected void btnGetVal_Click(object sender, EventArgs e)
{
foreach (RepeaterItem oRowRepeater in repGrid.Items)
{
if (oRowRepeater.ItemType == ListItemType.Item || oRowRepeater.ItemType == ListItemType.AlternatingItem)
{
HtmlTableCell nId = (HtmlTableCell)oRowRepeater.FindControl("val_k");
if(nId.InnerText.ToString().Equals(id_p.Value))
{
TextBox txtQ = (TextBox)oRowRepeater.FindControl("txtCell_Qta") as TextBox;
string qty = txtQ.Text;
//qty is dirty!!!!!
//Contains old value and new value comma separated...why?
//(Example if the initial value was "1,00" and i fill "3" then i get "1,00,3"...)
//
}
}
}
UpdGrid();
}
```
i've used asp for several years but i never experienced a shitty situation like this...and i'm afraid. The only thing that i play around it's the class="none" on the column, because that way my html table collapse the columns with the input and button. It seems that if i remove class="none" and the cells are visible evrithing work as expected. But if i use this collapsing functionality on the table starts giving me this kind of result.... Unfortunately i need this collapsing feature of datatable.
Does anybody ever figured out this situation?
Answers
We're happy to take a look, but as per the forum rules, please link to a test case - a test case that replicates the issue will ensure you'll get a quick and accurate response. Information on how to create a test case (if you aren't able to link to the page you are working on) is available here.
Cheers,
Colin