Prashant Malav

Prashant Malav

  • NA
  • 80
  • 19.7k

gridview textbox insert value after refresh label value

Mar 17 2016 1:09 AM
hello,
 
gridview textbox insert value after refresh another div label value in c# and
aspx.cs page get refresh new value .
 
code(aspx):-
<asp:UpdatePanel ID="UpdatePanelgridview" runat="server" UpdateMode="Conditional">
<ContentTemplate>


<asp:GridView ID="cartgrid" runat="server" Width="100%" OnPageIndexChanging="cartgrid_PageIndexChanging"
CellPadding="5" CellSpacing="1" GridLines="None" BorderWidth="0" OnRowDeleting="cartgrid_RowDeleting"
OnRowDataBound="cartgrid_RowDataBound" AutoGenerateColumns="False">
<Columns>
<asp:TemplateField>
<ItemTemplate>
<asp:Label ID="lblid" runat="server" Text='<%# Eval("id") %>' Visible="false"></asp:Label>
<%#"<a href=showproduct.aspx?pid=" + Eval("id") + "><img src='ProductImage/" + Eval("Pcode") + ".jpg' width='50px' height='50px' style='border:1px solid #023755;' /></a>"%>
</ItemTemplate>
<ItemStyle HorizontalAlign="center" VerticalAlign="Middle" Width="55px" Font-Size="11px"
Font-Names="Verdana" ForeColor="#666666" />
</asp:TemplateField>
<asp:TemplateField>
<HeaderTemplate>
<label>
Name</label>
</HeaderTemplate>
<ItemTemplate>
<b>Product Code #</b>
<asp:Label ID="pcode" CssClass="grid" runat="server" Text='<%# Eval("Pcode") %>'></asp:Label><br />
<asp:Label ID="name" CssClass="grid" runat="server" Text='<%# Eval("Title") %>'></asp:Label>
</ItemTemplate>
<ItemStyle Horizontal VerticalAlign="Middle" Width="250px" Font-Size="11px"
Font-Names="Verdana" ForeColor="#666666" />
</asp:TemplateField>
<asp:TemplateField>
<HeaderTemplate>
<label>
Size</label>
</HeaderTemplate>
<ItemTemplate>
<input type="text" id="txtsize" runat="server" value='<%# Eval("size") %>' style="width: 50px;"
disabled="disabled" />
</ItemTemplate>
<ItemStyle HorizontalAlign="center" VerticalAlign="Middle" Width="50px" Font-Size="11px"
Font-Names="Verdana" ForeColor="#666666" />
</asp:TemplateField>
<asp:TemplateField Visible="false">
<HeaderTemplate>
<label>
Comment</label>
</HeaderTemplate>
<ItemTemplate>
<textarea type="text" style="width: 40px; height: 15px" id="txtcomm" runat="server"
value='<%# Eval("comm") %>'></textarea>
</ItemTemplate>
<ItemStyle HorizontalAlign="center" VerticalAlign="Middle" Width="60px" Font-Size="11px"
Font-Names="Verdana" ForeColor="#666666" />
</asp:TemplateField>
<asp:TemplateField>
<HeaderTemplate>
<label>
Price($)</label>
</HeaderTemplate>
<ItemTemplate>
$<asp:Label ID="price" CssClass="grid" runat="server" Text='<%# Eval("price") %>'></asp:Label>
</ItemTemplate>
<ItemStyle HorizontalAlign="center" VerticalAlign="Middle" Width="50px" Font-Size="11px"
Font-Names="Verdana" ForeColor="#666666" />
</asp:TemplateField>
<asp:TemplateField HeaderText="Stock<br>Qty">
<ItemTemplate>
<asp:Label ID="lblStockqty" runat="server" Text='<%# Eval("stockqty") %>'></asp:Label>
</ItemTemplate>
<ItemStyle HorizontalAlign="center" VerticalAlign="Middle" Width="40px" Font-Size="11px"
Font-Names="Verdana" ForeColor="#666666" />
</asp:TemplateField>
<asp:TemplateField>
<HeaderTemplate>
<label>
Qty</label>
</HeaderTemplate>
<ItemTemplate>
<input id="txtqty" style="width: 30px;" onblur="return Updatecart();" type="text"
value='<%# Eval("qty") %>' runat="server" />
<br />
<input id="txtqty2" type="text" value="" runat="server" readonly="readonly" style="width: 30px;
border: solid 1 px white; color: black; display: none;" />
</ItemTemplate>
<ItemStyle HorizontalAlign="center" VerticalAlign="Middle" Width="20px" />
<HeaderStyle HorizontalAlign="center" Width="30px" />
</asp:TemplateField>
<asp:TemplateField HeaderText="Addtional<br>qty">
<ItemTemplate>
<input id="txtAddtionalQty" style="width: 30px;" type="text" value='<%# Eval("qty") %>'
runat="server" readonly="readonly" />
</ItemTemplate>
<ItemStyle HorizontalAlign="center" VerticalAlign="Middle" Width="30px" />
<HeaderStyle HorizontalAlign="center" Width="60px" Font-Size="11px" Font-Names="Verdana"
ForeColor="#666666" />
</asp:TemplateField>
<asp:TemplateField>
<HeaderTemplate>
<label>
Total</label>
</HeaderTemplate>
<ItemTemplate>
$<asp:Label ID="amt" runat="server" Text='<%# Eval("total") %>'></asp:Label>
</ItemTemplate>
<ItemStyle HorizontalAlign="center" VerticalAlign="Middle" Width="60px" Font-Size="11px"
Font-Names="Verdana" ForeColor="#666666" />
<HeaderStyle HorizontalAlign="center" Width="60px" />
</asp:TemplateField>
<asp:CommandField ShowDeleteButton="True" DeleteText="Remove">
<ItemStyle Horizontal VerticalAlign="Middle" Width="45px"></ItemStyle>
<ControlStyle Width="45px" Font-Size="11px" Font-Names="Verdana" ForeColor="#666666">
</ControlStyle>
</asp:CommandField>
</Columns>
<FooterStyle BackColor="#5D7B9D" ForeColor="White" Font-Bold="True"></FooterStyle>
<RowStyle BackColor="#F7F6F3" ForeColor="#333333" Height="55px"></RowStyle>
<SelectedRowStyle BackColor="#E2DED6" ForeColor="#333333" Font-Bold="True"></SelectedRowStyle>
<PagerStyle BackColor="#DDDDDD" ForeColor="#808080" HorizontalAlign="Center"></PagerStyle>
<HeaderStyle BackColor="#DDDDDD" ForeColor="#808080" Font-Bold="True" Height="30px">
</HeaderStyle>
<EditRowStyle BackColor="#999999" />
<AlternatingRowStyle BackColor="White" ForeColor="#284775"></AlternatingRowStyle>
</asp:GridView>

</div>




</ContentTemplate>
</asp:UpdatePanel>


<asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<div id="emptyTotal" runat="server" style="text-align: right; padding-right: 20px;"
visible="true">
<b>Grand Total :</b> $&nbsp;
<asp:Label ID="lblshoppingamt" runat="server" Text="$200.00"></asp:Label>
<asp:HiddenField ID="HDNshoppingamt" runat="server" Value=""></asp:HiddenField>
</div>
</ContentTemplate>
</asp:UpdatePanel>
 
code(aspx.cs)
 
protected void imgbtncheckout_Click(object sender, EventArgs e) //(object sender, EventArgs e)
{
try
{

Int16 checkamount = 250;
float bindvaluveamount = float.Parse(lblshoppingamt.Text);

note:- get value but old value get... so plz help me how to new value get.
if (bindvaluveamount >= checkamount)
{

if (Session["userid"] != null)
{
......
......
......
}
}
 

Answers (2)