locked
How to do this in JQuery RRS feed

  • Question

  • User-582711651 posted

    Hi any please support me,

    how to do below mentioned code into JQuery 

        Protected Sub Rbt_Row_CheckedChanged(sender As Object, e As System.EventArgs)
            Dim clickedRow As GridViewRow = TryCast(DirectCast(sender, RadioButton).NamingContainer, GridViewRow)
            Dim f_Txt_UID1 As TextBox = DirectCast(clickedRow.FindControl("Txt_UID1"), TextBox)
            f_Txt_UID1.Text = ""
            f_Txt_UID1.Focus()
            f_Txt_UID1.BackColor = Color.Yellow
        End Sub
    

    Thanks in advance 

    Wednesday, January 4, 2017 3:46 AM

Answers

  • User2103319870 posted

    You can try with the below code

    $(document).ready(function () {
                    //$("input[type=text][id*=Criteria]").attr("disabled", true);
                    //Attach click event to checkbox
                    $("input[type=radio][id*=RadioButton1]").click(function () {
                        //if current row checkbox is checked 
                        if (this.checked) {
                          
                            //Change your controls id here
                            //Set Value to empty in textbox
                            $(this).closest("tr").find("input[type=text][id*=Txt_UID1]").val();
                            //Set Focus to Textbox
                            $(this).closest("tr").find("input[type=text][id*=Txt_UID1]").focus();
                            //Chnage the background color to yellow
                            $(this).closest("tr").find("input[type=text][id*=Txt_UID1]").css("background-color", "yellow");
    
                        }
                        else {
                            //Change your controls id here
                            $(this).closest("tr").find("input[type=text][id*=Txt_UID1]").css("background-color", "white");
                        }
                    });
                });

    demo

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, January 4, 2017 4:10 AM
  • User-573138384 posted

    MultiLine renders as "textarea". Try replacing input[type=text] to textarea

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, January 4, 2017 1:18 PM

All replies

  • User2103319870 posted

    You can try with the below code

    $(document).ready(function () {
                    //$("input[type=text][id*=Criteria]").attr("disabled", true);
                    //Attach click event to checkbox
                    $("input[type=radio][id*=RadioButton1]").click(function () {
                        //if current row checkbox is checked 
                        if (this.checked) {
                          
                            //Change your controls id here
                            //Set Value to empty in textbox
                            $(this).closest("tr").find("input[type=text][id*=Txt_UID1]").val();
                            //Set Focus to Textbox
                            $(this).closest("tr").find("input[type=text][id*=Txt_UID1]").focus();
                            //Chnage the background color to yellow
                            $(this).closest("tr").find("input[type=text][id*=Txt_UID1]").css("background-color", "yellow");
    
                        }
                        else {
                            //Change your controls id here
                            $(this).closest("tr").find("input[type=text][id*=Txt_UID1]").css("background-color", "white");
                        }
                    });
                });

    demo

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, January 4, 2017 4:10 AM
  • User-582711651 posted

    Hi, 

    Nice, but its working in TextMode=SingleLine ,  not in TextMode="MultiLine", I am using Multiline textbox in my form, please suggest. 

    Thanks,

    Wednesday, January 4, 2017 1:02 PM
  • User-573138384 posted

    MultiLine renders as "textarea". Try replacing input[type=text] to textarea

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, January 4, 2017 1:18 PM
  • User-582711651 posted

    Hi Fayaz, 

    Yes, thanks I replaced to this  find("textarea[id*=Txt_UID1]") it works 

    Thanks for your instant support for both. 

    With best regards, 

    Wednesday, January 4, 2017 4:04 PM