Click here to Skip to main content
15,896,730 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
if i have code used in C#
C#
foreach (GridViewRow row in GridView1.Rows)
{
               Button bk = (Button)row.FindControl(Button2);// Your Edit button
               bk.Attributes.Add(onclick,return getmew(+row.RowIndex+));
}



in javascript code getmew()
C#
function getmew(dd)
    {
     var b=document.getElementById(GridView1);
     var c=document.getElementById(TextBox1);
     var d=document.getElementById(TextBox2);
     dd=dd+1;
     c.value=document.getElementById(GridView1).rows[dd].cells[2].innerHTML;
     d.value=document.getElementById(GridView1).rows[dd].cells[3].innerHTML;
}


how to do this
Posted
Comments
Sergey Alexandrovich Kryukov 2-May-11 1:09am    
1) To do what? You already do something. Where is your problem?

2) Tag it! Add ASP.NET tag.

--SA
shivani 2013 2-May-11 1:30am    
my question is function getmew is to be written in notepad and save it as .javascript and then how to call it in application
Sergey Alexandrovich Kryukov 2-May-11 4:20am    
I don't understand. Is it ASP.NET or not? What is "window application", a desktop? What is "C#.NET"? There is not such term...
--SA
Sergey Alexandrovich Kryukov 2-May-11 4:21am    
Or, I see, this must be the Browser application...
--SA
Ashishmau 2-May-11 1:10am    
good buddy, u copy pasted my answer as a Question and asking doubt.
Nice way

1 solution

The only way to use Javascript in a windows application is to contain a WebBrowser control, and set the DocumentText property to the HTML, including the javascript in that.
string s = File.ReadAllText(@"F:\Temp\MyWebPage.html");
myWebBrowser.DocumentText = s;
 
Share this answer
 
Comments
Sergey Alexandrovich Kryukov 2-May-11 5:19am    
Correct, a 5.
--SA

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900