This is a migrated thread and some comments may be shown as answers.

Label Text inside CommandItemTemplate not visible in after i click Delete

1 Answer 62 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Maha
Top achievements
Rank 1
Maha asked on 24 Aug 2012, 03:14 AM
Dear Sir/Madam


I'm Maha From India.


Advance Thank you for Helping me


I have RadGrid1(using Mutiselect checkbox option) in my project


Problem : Label Text inside CommandItemTemplate not visible in after i click Delete(LinkButton1)
==================================================================
Inside CommandItemTemplate I have Label(lblmsg) to display some message to user for validation and DB Deleted Message


If user clicking LinkButton(LinkButton1) without seelcting any checkbox means I write validation 


That validation message will display on this lblmsg correctly


But if user select the check box and then click Delete means I want to show Confirmation message to user


Message format : Customer ID1,Customer ID2 deleted from DB succesfully


The above message will not visible in RadGrid


But If i debug means Thats Label Text Properly assigned using C#(RadGrid1_ItemCommand)


Note:
====
After execution of RadGrid1_ItemCommand() ->RadGrid1_NeedDataSource() method invoked Automatically


So My Doubt is  whether RadGrid Reassign my Label Text as Empty.


Becoz in Browser View Source <span id="RadGrid1_ctl00_ctl03_ctl01_lblmsg"></span>


Inside span my Text is not there


Code.aspx
=========
Ajax Settings
==========================================================================================
 <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
                <AjaxSettings>
                   
               <telerik:AjaxSetting AjaxControlID="RadGrid1">
                    
                        <UpdatedControls>
                           
                            <telerik:AjaxUpdatedControl  ControlID="RadGrid1" LoadingPanelID="RadAjaxLoadingPanel1" />
                            
                            
                        </UpdatedControls>
                     
                 </telerik:AjaxSetting>
                    
                     
                    </AjaxSettings>
            </telerik:RadAjaxManager>
             
    <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" Skin="Default" runat="server"></telerik:RadAjaxLoadingPanel>
    
Grid Code
==========================================================================================
 <telerik:RadGrid ID="RadGrid1"  Width="100%" AllowFilteringByColumn="True"
            PageSize="12" ShowFooter="false" AllowPaging="True" runat="server"
            AutoGenerateColumns="False" GridLines="None" ShowStatusBar="false" 
            onneeddatasource="RadGrid1_NeedDataSource" AllowSorting="true" AllowMultiRowSelection="true" 
                ShowGroupPanel="false" onitemcommand="RadGrid1_ItemCommand">
              <GroupingSettings CaseSensitive="false" />
   
           <MasterTableView CommandItemDisplay="Bottom" Width="100%" AllowFilteringByColumn="true" GroupsDefaultExpanded="false">
<CommandItemTemplate>
<div style="padding-left:8px;">
<asp:LinkButton ID="LinkButton1" OnClientClick="javascript:return confirm('Delete all selected Jobs?')"
runat="server" Font-Size="13px" CommandName="DeleteSelected"><img style="border:0px;vertical-align:middle;" alt="" src="Images/Delete.gif" />Delete</asp:LinkButton>&nbsp;&nbsp;
<asp:Label ID="lblmsg" runat="server"></asp:Label>
</div>
</CommandItemTemplate>


                <Columns>
----
</Columns>


</MasterTableView>
            
   <ClientSettings EnableRowHoverStyle="true">
            <Selecting AllowRowSelect="true" />
        </ClientSettings>
 </telerik:RadGrid>
==========================================================================================
code.cs(C#)
======
protected void RadGrid1_ItemCommand(object sender, GridCommandEventArgs e)
        {
            if (e.CommandName == "DeleteSelected")
            {
                GridCommandItem commandItem = e.Item as GridCommandItem;


                Label lbl = commandItem.FindControl("lblmsg") as Label;
                lbl.Text = "";
                if (RadGrid1.SelectedIndexes.Count == 0)
                {
                    lbl.Text = "Not Selected any Customer IDs";
                    lbl.ForeColor = System.Drawing.Color.Red;
                    return;
                }


                System.Text.StringBuilder sbJobIds = new System.Text.StringBuilder();




                foreach (GridDataItem item in RadGrid1.MasterTableView.Items)
                {
                    if (item.Selected)
                    {
                        string customerid = item["CusID"].Text;
                        if (customerid != null && customerid.Trim().Length > 0)
                            sbJobIds.Append(customerid + ",");
                    }
                }
               
//DB Coding


-----
//
            
  lbl.Text = sbJobIds.ToString()+"deleted from DB succesfully";  //This Message will not be visible to user
  lbl.ForeColor = System.Drawing.Color.Green;
               
               
               
            }


        }


==========================================================================================


Please advice me whats can i do?


Awaiting for your favourable reply




With Regards,
Maha

1 Answer, 1 is accepted

Sort by
0
Maria Ilieva
Telerik team
answered on 28 Aug 2012, 12:01 PM
Hi Maha,

Please review the answer provided in the support ticket you have opened for the same issue and verify if it helps. I would also suggest you to continue our communication if further assiatance is needed in the Support Ticket so we could better track the issue.

Kind regards,
Maria Ilieva
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Tags
Grid
Asked by
Maha
Top achievements
Rank 1
Answers by
Maria Ilieva
Telerik team
Share this question
or