473,396 Members | 2,050 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Gridview Item Template Enter on Textbox to update

KalariaNitya
Hello,
could anybody help me?
i have gridview, inside gridview i have one Update button & textbox
update button update the quantity entered in textbox.
i want to update the quantity on textbox on ENTER event.

i had done below code:

page_load()

Dim dgitem1 As GridViewRow
Dim txtquantity As TextBox
Dim btnupdateqty As New Button

For Each dgitem1 In GridView1.Rows
txtquantity = dgitem1.FindControl("TextBox2")
btnupdateqty = dgitem1.FindControl("btnmodify")
txtquantity.Attributes.Add("onkeydown", "if(event.which || event.keyCode){if ((event.which == 13) || (event.keyCode == 13)) {document.getElementById('" + btnupdateqty.UniqueID + "').click();return false;}} else {return true}; ")
Next




inline code:--

<asp:GridView ID="GridView1" runat="server" Width="100%" RowStyle-CssClass="border_b"
GridLines="None" CellPadding="0" ShowHeader="False" AutoGenerateColumns="False">
<Columns>
<asp:TemplateField>
<ItemTemplate>
<table cellspacing="1" cellpadding="0" width="100%" border="0">
<tbody>
<tr>
<td align="center" width="100">
<a href='<%#FormatURL1(DataBinder.Eval(Container.Data Item,"prod_id"))%>' onclick="window.open(this.href,'','scrollbars=no, menubar=no, toolbar=no, resizable=yes, status=no, width=800, height=600'); return false;" target="_blank">
<asp:Image ID="Image1" runat="server" CssClass="border_img" ImageUrl='<%# FormatURL(DataBinder.Eval(Container.DataItem,"prod _id")) %>'
BorderStyle="Solid" BorderWidth="1px"></asp:Image></a></td>
<td valign="top">
<table id="Table1" cellspacing="0" cellpadding="3" width="100%" border="0">
<tbody>
<tr>
<td style="text-align: left; height: 30px;" class="paging" colspan="2" height="12">
&nbsp;&nbsp;&nbsp;<asp:Label ID="Label33" runat="server" CssClass="normaltext" Text="Product Name : "
Font-Bold="True"></asp:Label><asp:Label ID="lblinprodname" runat="server" CssClass="normaltext"
Text='<%# DataBinder.Eval(Container.Dataitem,"prod_name") %>' Font-Bold="True"></asp:Label><b
class="text_11_black_bold"></b></td>
</tr>
<tr>
<td style="width: 60%;" class="text_11_black_bold" align="left" height="12">
<table width="100%">
<tbody>
<tr>
<td style="width: 40%;" align="right"> Category:</td>
<td align="left" style="width: 60%">
<asp:Label ID="lblincategory" runat="server" Text='<%# DataBinder.Eval(Container.Dataitem,"cat_name") %>'
Font-Bold="False"></asp:Label></td>
</tr>
</tbody>
</table>
</td>
<td style="width: 20%;" class="text_11_black_bold" align="left">
<table width="100%">
<tbody>
<tr>
<td style="width: 50%" align="right">
Size:</td>
<td align="left" style="width: 50%">
<asp:Label ID="lblinsize" runat="server" Text='<%# DataBinder.Eval(Container.Dataitem,"size") %>'
Font-Bold="False"></asp:Label></td>
</tr>
</tbody>
</table>
</td>
</tr>
<tr>
<td class="text_11_black_bold" align="left" style="width: 60%">
<table width="100%">
<tbody>
<tr>
<td style="width: 40%;" align="right">
&nbsp;Sub Cat:</td>
<td align="left" style="width: 60%">
<asp:Label ID="lblinsubcategory" runat="server" Text='<%# DataBinder.Eval(Container.Dataitem,"scat_name") %>'
Font-Bold="False"></asp:Label></td>
</tr>
</tbody>
</table>
</td>
<td class="text_11_black_bold" align="left" style="width: 20%">
<table width="100%">
<tbody>
<tr>
<td style="width: 50%" align="right">
Weight:</td>
<td align="left" style="width: 50%">
<asp:Label ID="lblwgt2" runat="server" Text='<%# DataBinder.Eval(Container.Dataitem,"weight") %>'
Font-Bold="False"></asp:Label></td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
<asp:Label ID="Label4" runat="server" Visible="False" CssClass="text_11_black" Text='<%#DataBinder.Eval(Container.Dataitem,"prod_ id")%>'>

</asp:Label>
<asp:Label ID="lblincatid" runat="server" Visible="False" CssClass="text_11_black"
Text='<%# DataBinder.Eval(Container.Dataitem,"cat_id") %>'></asp:Label>
<asp:Label ID="lblinscatid" runat="server" Visible="False" CssClass="text_11_black"
Text='<%# DataBinder.Eval(Container.Dataitem,"scat_id") %>'></asp:Label>
<asp:Label ID="lblinprodid" runat="server" Visible="False" CssClass="text_11_black"
Text='<%#DataBinder.Eval(Container.Dataitem,"prod_ id")%>'></asp:Label>
<asp:Label ID="Label7" runat="server" Visible="False" CssClass="normaltext" Font-Bold="False"></asp:Label></td>
<td valign="top" style="width: 20%">
<table id="Table6" cellspacing="0" cellpadding="3" width="100%" align="center" border="0">
<tbody>
<tr>
<td class="paging" align="center" style="height: 30px" colspan="2">
<strong>Rate</strong>:<asp:Label ID="Label6" runat="server" CssClass="normaltext" Text='<%# DataBinder.Eval(Container.Dataitem,"rate") %>'></asp:Label>
<asp:Label ID="c1" runat="server" CssClass="normaltext" Text="<%# get_currency() %>"
Font-Bold="False"></asp:Label></td>
</tr>
<tr>
<td class="text_11_black_bold" align="right">
Qty:</td>
<td style="width: 100px" align="left">
<asp:TextBox onblur="Numeric_validation(this);" ID="TextBox2" runat="server" Width="40px"
CssClass="text_11_black" Text='<%# DataBinder.Eval(Container.DataItem,"qty") %>'
MaxLength="3"></asp:TextBox></td>
</tr>
<tr>
<td class="text_11_black_bold" align="right">
Total:</td>
<td style="width: 100px" align="left">
<asp:Label ID="Label71" runat="server" CssClass="normaltext" Text='<%# DataBinder.Eval(Container.Dataitem,"total") %>'
Font-Bold="False"></asp:Label>
<asp:Label ID="c2" runat="server" CssClass="normaltext" Text="<%# get_currency() %>"
Font-Bold="False"></asp:Label></td>
</tr>
</tbody>
</table>
</td>
</tr>
<tr>
<td align="right" colspan="3" height="35">
<table id="Table7" width="100%">
<tbody>
<tr>
<td style="height: 23px; width: 20%;" width="92" align="center">
<asp:LinkButton ID="lnkRemove" runat="server" CssClass="text_9_maroon_link" Text="Remove Item"
CommandArgument='<%# eval ("Prod_id") & "<||>" & eval("Prod_name") & "<||>" & String.Format(Ctype(Container,GridViewRow).RowInde x)%>'
CommandName="del"></asp:LinkButton></td>
<td style="height: 23px; width: 60%;" colspan="2">
&nbsp;&nbsp;
</td>
<td style="height: 23px; width: 20%;" align="center" width="88">
<asp:Button ID="btnmodify" OnClick="test1" runat="server" CssClass="btn_main" Text="Update">
</asp:Button></td>
</tr>
<tr>
<td colspan="4" style="height: 20px">
</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
</ItemTemplate>
</asp:TemplateField>
</Columns>
<RowStyle CssClass="border_b"></RowStyle>
</asp:GridView>




public function test1()
''Here code to update quantity
end function

could anybody help me?

what i have to do?

any help will be appriciated..



i want to call test1 function, when i press enter on textbox
May 15 '08 #1
0 2509

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: John_H | last post by:
Re: ASP.NET 2.0 I would like suggestions or code examples on how to collect a variable length list of input data (item# & item quantity specifically). I thought that I could accomplish this...
0
by: Mike P | last post by:
Where exactly are the updateparameters of a gridview picked up from? I have created 2 very similar gridviews and given the updateparameters the same names as in my edititemtemplates. Yet this...
2
by: LearnMore.John | last post by:
Is it possible to update all the rows in a single postback using Gridview Control, regards John
0
by: Mike P | last post by:
I am trying to edit a gridview while using paging, but whenever I try to edit a row on a page other than page 1, I get an error. Here is my gridview and my code : <asp:GridView ID="GridView1"...
0
by: DC | last post by:
The problem I'm using the .NET GridView and FormView objects for the first time and im getting the error "An OleDbParameter with ParameterName '@ID' is not contained by this...
6
by: =?Utf-8?B?UGF1bA==?= | last post by:
Hi I have a gridview control with a template column that has a textbox and when the control is bound to the datasource the textbox is filled ok. I then change what is in the textbox in the gridview...
11
by: SAL | last post by:
Hello, I have a Gridview control (.net 2.0) that I'm having trouble getting the Update button to fire any kind of event or preforming the update. The datatable is based on a join so I don't know...
0
by: steve | last post by:
I have been fighting with trying to update a GridView for a while. I don't want to use the "built-in" way to do it because I am using business layer methods for updating and deleteing and I don't...
1
by: Mel | last post by:
I have a GridView that is bound to a DataTable. I decided to allow the user to change the column data right in the ItemTemplate. Then user won't need to click Edit to change the values and then...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.