0

Hi,
i was trying to call JQuery function from my backend C#.

the JQuery

        function testtesttest(testurl,counter)
        {
            $("'#imgThumbnail"+counter+"').attr('ImageURL','"+testurl+"');
            $('#imgThumbnail'+counter+').show();
        }

backend C# code

        int counter = 0;
        while(counter<list.Count)
        {
        int imgcounter = 1;
        string testurl = list[counter]; 
        ClientScript.RegisterStartupScript(this.GetType(), "sc", "testtesttest("+testurl+", "+counter+")", true);
        imgcounter++;
        counter++;
        }

I trying to pass 2 value into the function, but i just dont know how to assign the symbol " and '.

1
Contributor
1
Reply
10
Views
3 Years
Discussion Span
Last Post by ocw91
0

ok i make the thing work in a different way ...
now the new problem is i cannot call the javascript from my C#

the code now is

function testtesttest(testid, stringURL) {
        {
            var ID = testid;
            var URL = stringURL;
            $('ID').attr('src','URL');
            $('ID').show();
        }

Backend C#

        int counter = 0;
        while(counter<list.Count)
        {
        string testid = "#imgThumbnail" + (counter+1);
        string stringURL = list[counter];
        ClientScript.RegisterStartupScript(this.GetType(), "sc", "testtesttest("+testid+", "+stringURL+")", true);
        counter++;
        }

It seem that the code just run through the ClientScript.RegisterStartupScript and that's it
(i put an alert into the Javascript and it didnt popout at all)
can anyone help me?

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.