Quantcast
Channel: Visual Studio and Visual Web Developer Express
Viewing all articles
Browse latest Browse all 3509

Javascritp Function for the repeater

$
0
0

Hi

My textbox  and linkbutton (asp.net)is inside the repeater.How can i enable textbox with java script function upon click of a link button .It is working fine in vb.net.I want to avoid the post back  on each click of Edit link button,Below is the textbox and link button

<asp:TextBox ID="TextBox1" runat="server" Text='<%# DataBinder.Eval(Container.DataItem,"LicenseID") %>' Enabled="False" BackColor="Gray" BorderStyle="None"></asp:TextBox>

<asp:LinkButton Visible="true" ID="LinkButton5" runat="server"  CommandName="update" CommandArgument='<%# DataBinder.Eval(Container.DataItem, "LicenseID") %>'  CausesValidation="False" onClientClick="MyFunction();return false" >Update</asp:LinkButton>

<script>

function MyFunction(txtRefId)

{

   var textBox = document.getElementById(txtRefId);

    document.getElementById("textBox").disabled = false;

}

</script>

Above function MyFunction is Not working.I can not make the textbox enable.

Below vb.net code is working fine.I want to accomplish this with the javascript function for the Edit.

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

            endif

 

Appreciate your help..Thanks

 


Viewing all articles
Browse latest Browse all 3509