Avatar of HPH Y
HPH Y
 asked on

Javascrip And asp.Net vb help needed

This method adds a javascript method to marks text box onkeydown, that javascript method takes the rowindex as argument. This code is being converted from C#. The method works fine using C#, but I got a “Conversion from string "javascript: DoPostBackWithRowInd" to type 'Double' is not valid “message when using the VB code below. Please help!


<script type="text/javascript" language="javascript">

        function DoPostBackWithRowIndex(rowIndex) {

            if (document.getElementById('<%=HdnSelectedRowIndex.ClientID%>') != null) {

                document.getElementById('<%=HdnSelectedRowIndex.ClientID%>').value = rowIndex;

            }

            return true;

        }

    </script>

 

'Event to handle the Users Grid DataBound Event
'This method adds a javascript method to marks text box onkeydown, that javascript method takes the rowindex as argument.

    Protected Sub GvUsersRowDataBound(ByVal sender As Object, ByVal eventArgs As GridViewRowEventArgs)

        If (eventArgs.Row.RowType = DataControlRowType.DataRow) Then

            Dim TxtMarks As TextBox = CType(eventArgs.Row.FindControl("TxtMarks"), TextBox)

            TxtMarks.Attributes.Add("onkeydown", "javascript:return DoPostBackWithRowIndex('" + eventArgs.Row.RowIndex + "');")

        End If

 

    End Sub
JavaScriptASP.NET

Avatar of undefined
Last Comment
HPH Y

8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
Ramkisan Jagtap

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
HPH Y

ASKER
Hi Ramkisan, Thanks for helping me. Your answer is very helpful because it eliminated the error and I was able to debug the problem further. I eventually also needed  to substitute the two + sign to & sign in order to pass the javascript function properly. Again, your help is truly appreciated!!!! :)
This is the best money I have ever spent. I cannot not tell you how many times these folks have saved my bacon. I learn so much from the contributors.
rwheeler23