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 '.

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?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.