Disabling A Button Inside A Gridview Using Jquery
I have a gridview and on the 6th column there is a link button. I want to enable/disable the link button according to the value of 7th column.... Iam using the following code. but
Solution 1:
Try disabling the link button inside the td instead of disabling the td.
Something like
$(this).find('td:eq(6) a').attr("disabled", true);
Find the anchor tag inside the td.
But the better method will be check this in the server side itself.
You can hook the RowDataBound event and inside that you can check for this.
Solution 2:
Why you want to use Jquery to perform this task while you can achieve this easily by using Gridview's RowDataBound event. Try this one:
ProtectedSub gvSample_RowDataBound(ByVal sender AsObject, ByVal e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles gvSample.RowDataBound
Dim objDRV As DataRowView = CType(e.Row.DataItem, DataRowView)
If e.Row.RowType = DataControlRowType.DataRow ThenDim btnApprove As LinkButton = CType(e.Row.FindControl("btnApprove"), LinkButton)
IfNot objDRV("Column7") IsNothingAndAlso objDRV("Column7").ToString() <> ""Then
btnApprove.Enabled = FalseElse
btnApprove.Enabled = TrueEndIfEndIfEndSub
Solution 3:
Why jQuery?Did you try LinkButton.Enabled Property?
Post a Comment for "Disabling A Button Inside A Gridview Using Jquery"