Hi. I don't know how to explain this properly. The thing is, I have a products page, with a treeview on left, (telerik) and on the right there is a div. The div on the right is used to load stuff in it, (using jquery, calling another aspx with a querystring parameter), called from Telerik Treeview's client-side OnNodeSelecting event ... Everything works as expected. There is also a RadioButton list (asp.net rbl) on top of this page, that is set to AutoPostBack. It switched the current language of the page. In all the other pages, it changes the Language and reloads the page. Then browsing the proıducts is pure client-side by loading into the rihgtmost div, (jquery calling another aspx page with a parameter, and loads the resulting HTML into the div).
What happens is, once I load content into this div, and then try to select another language from the RadioButtonList, whole window redirects to the aspx page that is supposed to provide the content to jQuery load. I have absolutely no clue why that happens.
Code below:
TreeView is actually inside an ascx. The client-side code is
$(document).ready(function() {
loadproduct(getDefaultUrl());
});
function getDefaultUrl() {
var hf = document.getElementById('ctl00_cphContent_hfLastSelectedProductUrl'); ///this is for preserving the state
var url = hf.value;
return url;
}
function UrunMenuNodeClicking(sender, args) {
var node = args.get_node();
var val = node.get_value();
if (!val) {
node.toggle();
loadproduct(getDefaultUrl());
}
else {
var url = "UrunLoad.aspx?q=" + val;
loadproduct(url);
}
}
function loadproduct(url) {
var wrapper = document.getElementById('UrunContentLoad');
$(wrapper).load(url);
}
ASPX that contains the treeview and the empty div, that takes HTML with load
<div style="float: left; width: 260px; margin-left: 20px">
Product Groups
////jQuery will load into this one ...
Language Control (ascx) at the top , which is a RadioButtonList
<div style="float: left; width: 260px; margin-left: 20px">
Ürün Grupları
Codebehind: (that changes the language and reloads)
public partial class LanguageControl : MyControl { protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { SetLanguageIndex(); } } public event CommandEventHandler LanguageChanged;
protected void RadioButtonList1_SelectedIndexChanged(object sender, EventArgs e)
{
CurrentLanguage = (Languages)RadioButtonList1.SelectedIndex; ///Sessiona burdan gidiyo
CommandEventArgs arg = new CommandEventArgs("LanguageIndex", RadioButtonList1.SelectedIndex);
LanguageChanged(RadioButtonList1, arg);
}
protected void SetLanguageIndex()
{
RadioButtonList1.SelectedIndex = CurrentLanguageIndex;
}
}
note: the Class MyControl inherits from System.Web.UI.UserControl , and has a property that accesses Session and sets the current language as an integer. Actually it is an enum like Languages.English, I do (int)enum and send it to session ...