473,573 Members | 4,459 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Gridview Item Template Enter on Textbox to update

KalariaNitya
34 New Member
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.FindCon trol("TextBox2" )
btnupdateqty = dgitem1.FindCon trol("btnmodify ")
txtquantity.Att ributes.Add("on keydown", "if(event.w hich || event.keyCode){ if ((event.which == 13) || (event.keyCode == 13)) {document.getEl ementById('" + btnupdateqty.Un iqueID + "').click();ret urn false;}} else {return true}; ")
Next




inline code:--

<asp:GridView ID="GridView1" runat="server" Width="100%" RowStyle-CssClass="borde r_b"
GridLines="None " CellPadding="0" ShowHeader="Fal se" AutoGenerateCol umns="False">
<Columns>
<asp:TemplateFi eld>
<ItemTemplate >
<table cellspacing="1" cellpadding="0" width="100%" border="0">
<tbody>
<tr>
<td align="center" width="100">
<a href='<%#Format URL1(DataBinder .Eval(Container .DataItem,"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="borde r_img" ImageUrl='<%# FormatURL(DataB inder.Eval(Cont ainer.DataItem, "prod_id")) %>'
BorderStyle="So lid" BorderWidth="1p x"></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;&nb sp;<asp:Label ID="Label33" runat="server" CssClass="norma ltext" Text="Product Name : "
Font-Bold="True"></asp:Label><asp: Label ID="lblinprodna me" runat="server" CssClass="norma ltext"
Text='<%# DataBinder.Eval (Container.Data item,"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="lblincatego ry" runat="server" Text='<%# DataBinder.Eval (Container.Data item,"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.Data item,"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="lblinsubcat egory" runat="server" Text='<%# DataBinder.Eval (Container.Data item,"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.Data item,"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='<%#DataBi nder.Eval(Conta iner.Dataitem," prod_id")%>'>

</asp:Label>
<asp:Label ID="lblincatid " runat="server" Visible="False" CssClass="text_ 11_black"
Text='<%# DataBinder.Eval (Container.Data item,"cat_id") %>'></asp:Label>
<asp:Label ID="lblinscatid " runat="server" Visible="False" CssClass="text_ 11_black"
Text='<%# DataBinder.Eval (Container.Data item,"scat_id") %>'></asp:Label>
<asp:Label ID="lblinprodid " runat="server" Visible="False" CssClass="text_ 11_black"
Text='<%#DataBi nder.Eval(Conta iner.Dataitem," prod_id")%>'></asp:Label>
<asp:Label ID="Label7" runat="server" Visible="False" CssClass="norma ltext" 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:La bel ID="Label6" runat="server" CssClass="norma ltext" Text='<%# DataBinder.Eval (Container.Data item,"rate") %>'></asp:Label>
<asp:Label ID="c1" runat="server" CssClass="norma ltext" 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(thi s);" ID="TextBox2" runat="server" Width="40px"
CssClass="text_ 11_black" Text='<%# DataBinder.Eval (Container.Data Item,"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="norma ltext" Text='<%# DataBinder.Eval (Container.Data item,"total") %>'
Font-Bold="False"></asp:Label>
<asp:Label ID="c2" runat="server" CssClass="norma ltext" 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:LinkButt on ID="lnkRemove" runat="server" CssClass="text_ 9_maroon_link" Text="Remove Item"
CommandArgument ='<%# eval ("Prod_id") & "<||>" & eval("Prod_name ") & "<||>" & String.Format(C type(Container, GridViewRow).Ro wIndex)%>'
CommandName="de l"></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_m ain" Text="Update">
</asp:Button></td>
</tr>
<tr>
<td colspan="4" style="height: 20px">
</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
</ItemTemplate>
</asp:TemplateFie ld>
</Columns>
<RowStyle CssClass="borde r_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 2525

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

Similar topics

1
3852
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 using a GridView that has ViewState enabled, an ObjectDataSource to process the submitted list, textboxes for getting new item data and an add button. ...
0
2380
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 method has worked for 1 gridview and failed for the second gridview. Here is my gridview : <asp:SqlDataSource ID="SqlDataSource1" runat="server"...
2
2305
by: LearnMore.John | last post by:
Is it possible to update all the rows in a single postback using Gridview Control, regards John
0
2469
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" runat="server" DataSourceID="SqlDataSource1" DataKeyNames="UserKey" AllowSorting="True" HeaderStyle-Height="24px" AutoGenerateColumns="false"...
0
3549
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 OleDbParameterCollection" whenI try to write a new record. Delete and Modify work fine its just the add record function causes the error.
6
1971
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 control and in the gridview_RowDataBound event I have string DiscDescrip = Convert.ToString((e.Row.Cells.FindControl("txbxDiscgv") as TextBox...
11
6052
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 if that's what's causing the behavior or not. It seems like the Update button should at least do something. When the Edit button is clicked, the...
0
4253
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 want to have my parameter names in those methods have to be "original_Parametername" or even if I change the OldValuesParameterFormatString to get...
1
5168
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 click Update to save them because for this application the user will need to edit the data in every row so I thought the ItemTemplate would be a...
0
7661
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
1
7730
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
8028
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6349
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5550
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5252
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3692
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
1
2164
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1263
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.