hello
i have 4 main control, a radcombobox, radlistview with a asp button, and a label, i want to filter radlistview data by radcombobox selected value,( i do it without problem), and after click on asp button in radlistview, that return datakey with button commandargument value to label, but my problem is after click on asp button, label show nothing.
RadComboBox code:
aspx:
cs:
RadListView Code:
aspx:
cs:
ASP Button Code:
cs:
RadAjaxManager Code:
aspx:
ASP Label:
aspx:
i have 4 main control, a radcombobox, radlistview with a asp button, and a label, i want to filter radlistview data by radcombobox selected value,( i do it without problem), and after click on asp button in radlistview, that return datakey with button commandargument value to label, but my problem is after click on asp button, label show nothing.
RadComboBox code:
aspx:
<telerik:RadComboBox ID="CityDDL" runat="server" AutoPostBack="true" Label="City :" Skin="Default" />protected void LoadCities(){ SqlConnection connection = new SqlConnection( ConfigurationManager.ConnectionStrings["SiteSqlServer1"].ConnectionString); SqlDataAdapter adapter = new SqlDataAdapter(@"", connection); DataTable dt = new DataTable(); adapter.Fill(dt); CityDDL.DataTextField = "Name"; CityDDL.DataValueField = "ID"; CityDDL.DataSource = dt; CityDDL.DataBind(); // Insert the first item. CityDDL.Items.Insert(0, new RadComboBoxItem("- Select City -"));}RadListView Code:
aspx:
<telerik:RadListView ID="RadListView1" runat="server" DataSourceID="SqlDataSource1" ItemPlaceholderID="ListViewContainer" AllowPaging="True" PageSize="12" onprerender="RadListView1_PreRender"> <LayoutTemplate> <asp:PlaceHolder runat="server" id="ListViewContainer" /> </LayoutTemplate> <ItemTemplate> <fieldset style="float: left; width: 266px; height: 260px;"> <legend><b>State Name:</b>: <%#Eval("Name")%></legend> <div class="details"> <asp:Button ID="SelectStateID" OnClick="SelectStateID_Click"
CommandArgument='<%# Eval("ID") %>' runat="server" Text="Select State" /> <div class="data-container"> <ul> <li> <label> State Code: <%#Eval("Code")%> </li> </ul> </div> </div> </fieldset> </ItemTemplate></telerik:RadListView>cs:
protected void RadListView1_PreRender(object sender, EventArgs e){ foreach (RadListViewItem item in RadListView1.Items) { Button lnk = item.FindControl("SelectStateID") as Button; RadAjaxManager1.AjaxSettings.AddAjaxSetting(lnk, Label1); }}ASP Button Code:
cs:
protected void SelectStateID_Click(object sender, EventArgs e){
var argument = ((Button)sender).CommandArgument; Label1.Text = argument.ToString();}RadAjaxManager Code:
aspx:
<telerik:RadAjaxManager ID="RadAjaxManager1" runat="server" DefaultLoadingPanelID="RadAjaxLoadingPanel1"> <AjaxSettings> <telerik:AjaxSetting AjaxControlID="CityDDL" EventName="SelectedIndexChanged"> <UpdatedControls> <telerik:AjaxUpdatedControl ControlID="RadListView1" /> </UpdatedControls> </telerik:AjaxSetting> <telerik:AjaxSetting AjaxControlID="SelectStateID" EventName="SelectStateID_Click"> <UpdatedControls> <telerik:AjaxUpdatedControl ControlID="Label1" /> </UpdatedControls> </telerik:AjaxSetting> </AjaxSettings> </telerik:RadAjaxManager> <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server"> <asp:Image ID="Image1" runat="server" ImageUrl="~/images/WebResource.axd.gif" AlternateText="Loading..." /> </telerik:RadAjaxLoadingPanel>ASP Label:
aspx:
<asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>
please help me.
thanks