Answered by:
LinkButton in Gridview

Question
-
User-1499457942 posted
Hi
I have below code but when i click on Link Button nothing is happening
<asp:TemplateField HeaderText="Action"> <ItemTemplate> <asp:linkbutton id="btnEdit" ToolTip="Update Record" OnClick="lnkEdit_Click" runat="server" CssClass="clslnkbutton"/> </ItemTemplate>
protected void lnkEdit_Click(object sender, EventArgs e)
{
}Thanks
Tuesday, August 14, 2018 3:30 PM
Answers
-
User475983607 posted
JagjitSingh
Yes . Why so . When i commented required field validator then it is postingI believe the problem is self explanatory. txtDescription is required but a value was not entered.
Maybe you need validation groups?
- Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
Tuesday, August 14, 2018 4:42 PM
All replies
-
User475983607 posted
The common approach is using add, edit, and delete command buttons.
If the the page is not posting at all then you might have validation stopping the post. Please take a moment to debug your code using dev tools to verify what's happening.
Tuesday, August 14, 2018 4:10 PM -
User-1499457942 posted
Hi
Yes . Why so . When i commented required field validator then it is posting
<div class="form-group"> <asp:Label ID="lblCode" runat="server" CssClass="col-sm-4 control-label" Text="Code"></asp:Label> <div class="col-sm-5"> <asp:TextBox ID="txtCode" CssClass="form-control" runat="server"></asp:TextBox> <asp:RequiredFieldValidator ID="rfv1" CssClass="text-danger" runat="server" ErrorMessage="This field is Required !" ControlToValidate="txtCode"></asp:RequiredFieldValidator> </div> </div> <div class="form-group"> <asp:Label ID="lblDescription" runat="server" CssClass="col-sm-4 control-label" Text="Description"></asp:Label> <div class="col-sm-8"> <asp:TextBox ID="txtDescription" CssClass="form-control" runat="server"></asp:TextBox> <%--<asp:RequiredFieldValidator ID="rfv2" CssClass="text-danger" runat="server" ErrorMessage="This field is Required !" ControlToValidate="txtDescription"></asp:RequiredFieldValidator>--%> </div> </div>
Thanks
Tuesday, August 14, 2018 4:28 PM -
User475983607 posted
JagjitSingh
Yes . Why so . When i commented required field validator then it is postingI believe the problem is self explanatory. txtDescription is required but a value was not entered.
Maybe you need validation groups?
- Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
Tuesday, August 14, 2018 4:42 PM