Note that there are some explanatory texts on larger screens.

plurals
  1. POLink Button inside Repeater detail section
    primarykey
    data
    text
    <p>I have link buttons inside the deatail section of a repeater control.On Edit,the asp.net textboxes will become enabled with change back colour.On Save the values will be saved to the database.To avoid post back i am forced to change server side code to javascript function.How can i write function to do the same action in java script on click of linkbutton.For Update link button ->Is it possible to do the same in Javascript function.</p> <p>Thanks in advance.</p> <pre><code> &lt;asp:LinkButton ID="lnkEdit" runat="server" CommandName="edit" CommandArgument='&lt;%# DataBinder.Eval(Container.DataItem, "LicenseID") %&gt;' CausesValidation="False" onClientClick="JSFunction();return false"&gt;Edit&lt;/asp:LinkButton&gt; &lt;asp:LinkButton Visible="true" ID="LinkButton5" runat="server" CommandName="update" CommandArgument='&lt;%# DataBinder.Eval (Container.DataItem, "LicenseID") %&gt;' CausesValidation="False" onClientClick="MyJSFunction();return false" &gt;Update&lt;/asp:LinkButton&gt; If e.CommandName = "edit" Then DirectCast(e.Item.FindControl("TextBox2"), TextBox).Enabled = True DirectCast(e.Item.FindControl("Textbox2"), TextBox).BorderStyle = BorderStyle.NotSet DirectCast(e.Item.FindControl("Textbox2"), TextBox).BackColor = Drawing.Color.White end if If e.CommandName = "update" Then Dim bookName As String = DirectCast(e.Item.FindControl("Textbox2"), TextBox).Text Dim author As String = DirectCast(e.Item.FindControl("TextBox3"), TextBox).Text Dim pub As String = DirectCast(e.Item.FindControl("TextBox4"), TextBox).Text Dim price As String = DirectCast(e.Item.FindControl("TextBox5"), TextBox).Text Dim adp As New SqlDataAdapter("Update abc set License= @License, StartDate=@StartDate,Renewal=@Renewal,VendorPONo=@VendorPONo where LicenseID = @LicenseID", con) adp.SelectCommand.Parameters.AddWithValue("@LicenseName", bookName) adp.SelectCommand.Parameters.AddWithValue("@StartDate", author) adp.SelectCommand.Parameters.AddWithValue("@Renewal", pub) adp.SelectCommand.Parameters.AddWithValue("@VendorPONo", price) adp.SelectCommand.Parameters.AddWithValue("@LicenseID", e.CommandArgument) Dim ds As New DataSet() adp.Fill(ds) BindRepeater() End If </code></pre> <p>EDIT</p> <p>When i try for enabling the textbox as below, 'TextBox4' is not declared. It may be inaccessible due to its protection level error is showing </p> <pre><code> &lt;script type="text/javascript"&gt; function MyJSFunction() { var textBox = document.getElementById("&lt;%=TextBox4.ClientID %&gt;"); textBox.enabled = true; textBox.focus(); } &lt;/script&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload