From: Deep on 30 Mar 2010 08:45 Hi, I have taken a gridview and in ItemTemplate I have taken a link button for insert record. when any body fills text box and then click insert record. Record inserted successfully. Textbox are also inside itemtemplate of gridview. I want before inserting data textbox should be checked for empty data. How to call javascript function from link button and how to access that textbox value in javascript function. My html form is like that <form id="form1" runat="server"> <div> </div> <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" AutoGenerateDeleteButton="True" AutoGenerateEditButton="True" onrowcancelingedit="GridView1_RowCancelingEdit" onrowdeleting="GridView1_RowDeleting" onrowediting="GridView1_RowEditing" onrowupdating="GridView1_RowUpdating" onrowcommand="GridView1_RowCommand" ShowFooter="true"> <Columns> <asp:TemplateField HeaderText="EmpId"> <FooterTemplate> <asp:LinkButton ID="lnkAdd" runat="server" CommandName="AddNew" onclick="lnkAdd_Click">Insert</asp:LinkButton> </FooterTemplate> <ItemTemplate> <asp:Label ID="lblId" runat="server" Text='< %#Eval("EmpId")%>'></asp:Label> </ItemTemplate> </asp:TemplateField> <asp:TemplateField HeaderText="Name"> <EditItemTemplate> <asp:TextBox ID="txtName" runat="server" Text='< %#Eval("Name")%>'></asp:TextBox> </EditItemTemplate> <FooterTemplate> <asp:TextBox ID="txtNewName" runat="server"></ asp:TextBox> </FooterTemplate> <ItemTemplate><%#Eval("Name")%></ItemTemplate> </asp:TemplateField> <asp:TemplateField HeaderText="Age"> <EditItemTemplate> <asp:TextBox ID="txtAge" runat="server" Text='< %#Eval("Age")%>'></asp:TextBox> </EditItemTemplate> <FooterTemplate> <asp:TextBox ID="txtNewAge" runat="server"></ asp:TextBox> </FooterTemplate> <ItemTemplate><%#Eval("Age")%></ItemTemplate> </asp:TemplateField> <asp:TemplateField HeaderText="Salary"> <EditItemTemplate> <asp:TextBox ID="txtSalary" runat="server" Text='< %#Eval("Salary")%>'></asp:TextBox> </EditItemTemplate> <FooterTemplate> <asp:TextBox ID="txtNewSalary" runat="server"></ asp:TextBox> </FooterTemplate> <ItemTemplate><%#Eval("Salary")%></ItemTemplate> </asp:TemplateField> </Columns> </asp:GridView> <asp:LinkButton ID="LinkButton1" runat="server">LinkButton</ asp:LinkButton> </form> Please help me Thanks in Advance
From: Jeff Johnson on 30 Mar 2010 09:53 "Deep" <vinodkus(a)gmail.com> wrote in message news:43eac145-0269-4f42-88ba-02f4bf740e0a(a)y17g2000yqd.googlegroups.com... > Please help me Here's the best help I can give: This question has nothing to do with C# and everything to do with ASP.NET. Repost it in an ASP.NET group and you'll get the help you're looking for.
From: Mr. Arnold on 30 Mar 2010 10:03 "Deep" wrote: > Hi, > I have taken a gridview and in ItemTemplate I have taken a link > button for insert record. > when any body fills text box and then click insert record. Record > inserted successfully. Textbox are also inside itemtemplate of > gridview. > > I want before inserting data textbox should be checked for empty > data. > > How to call javascript function from link button and how to access > that textbox value in javascript function. > > > </asp:GridView> > <asp:LinkButton ID="LinkButton1" runat="server">LinkButton</ > asp:LinkButton> > </form> > <http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.linkbutton.onclientclick%28VS.80%29.aspx> <http://www.tizag.com/javascriptT/javascript-getelementbyid.php> If you have anymore asp.net questions, they would be better answered in the ASP.NET fourm. microsoft.public.dotnet.framework.aspnet
|
Pages: 1 Prev: Application wide transaction scope?! Next: about culture and globalization |