开发者

How to change link without reload (MVC2 / AJAX problem)

I have been following this example http://demos.telerik.com/aspnet-mvc/grid/selectionclientside?theme=webblue, and have finished it for my spec. In my spec, the top table lists the name of a number of different database tables, and then the bottom displays the data of whichever specific table name was clicked.

Now I have encountered a problem. Basically for the bottom table (in that example the orders table) I have added another column with an edit link for each row. Now obviously I will need to update where the link is pointing at. How can I do this? (I am unsure as I'm fairly sure this is using AJAX binding, but is more or less implemented for me)

For example, lets say (in the top table) I have links to seperate tables Country and State. They are similar Country (CountryId, CountryName) and State (StateId, StateName).

So the edit links should change like after clicking (for example)

State: http:开发者_如何转开发//localhost:xxxx/Tables/State/Edit/X

and after clicking

Country: http://localhost:xxxx/Tables/Country/Edit/X


Add javascript to the onclick event of the link/button. In this javascript, you can walk the DOM to find the html link element and change the href property of it.

http://www.w3schools.com/jsref/dom_obj_anchor.asp

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜