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>
<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
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>
<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