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

record info in delete confirmation

3 Answers 49 Views
Grid
This is a migrated thread and some comments may be shown as answers.
PINCO
Top achievements
Rank 1
PINCO asked on 05 Jun 2012, 07:28 AM
Hello
I Use GridButton Column For Delete An Row.I Want Show Row Info(For Example ProductID)  In PopUp With Rad Window And Then Perform Delete Command.
And My Source Is:
<telerik:RadWindowManager ID="RadWindowManager" runat="server"
        Animation="Slide" Skin="Vista"
    VisibleStatusbar="false" ShowContentDuringLoad="false" ReloadOnShow="true"
        Title="Confirm" />
     
        <telerik:RadGrid ID="RadGrid1" runat="server"
        DataSourceID="SqlDataSource1" GridLines="Vertical" Skin="Sunset" Width="99%"
            AutoGenerateColumns="False" AllowFilteringByColumn="True"
            oneditcommand="RadGrid1_EditCommand"
            onupdatecommand="RadGrid1_UpdateCommand"
            ondeletecommand="RadGrid1_DeleteCommand"
            oninsertcommand="RadGrid1_InsertCommand"
            onneeddatasource="RadGrid1_NeedDataSource" AllowSorting="True"
            AllowPaging="True" onitemcreated="RadGrid1_ItemCreated"
            onprerender="RadGrid1_PreRender" onitemcommand="RadGrid1_ItemCommand"
            Font-Names="Rod" Font-Overline="False" onitemdatabound="RadGrid1_ItemDataBound">
            <GroupingSettings CaseSensitive="false"  />
            <ClientSettings>
                <Selecting AllowRowSelect="True" />
            </ClientSettings>
        <MasterTableView DataKeyNames="ProductID"
                        DataSourceID="SqlDataSource1" CommandItemDisplay="Top"   Font-Names="Tahoma"
                PageSize="20">
        <RowIndicatorColumn>
        <HeaderStyle Width="20px"></HeaderStyle>
        </RowIndicatorColumn>
 
        <ExpandCollapseColumn>
        <HeaderStyle Width="20px"></HeaderStyle>
        </ExpandCollapseColumn>
            <Columns>
            <telerik:GridTemplateColumn UniqueName="TemplateColumn" HeaderText="شماره سطر">
                        <ItemTemplate>
                            <asp:Label ID="numberLabel" runat="server" />
                        </ItemTemplate>
                    </telerik:GridTemplateColumn>
               <telerik:GridBoundColumn DataField="ProductID" HeaderText="سریال محصول"
            ReadOnly="True" SortExpression="ProductID" UniqueName="ProductID">
        </telerik:GridBoundColumn>
        <telerik:GridBoundColumn DataField="MaxUse" DataType="System.Byte"
            HeaderText="حداکثر استفاده" SortExpression="MaxUse" UniqueName="MaxUse">
        </telerik:GridBoundColumn>
        <telerik:GridBoundColumn DataField="Used" DataType="System.Byte"
            HeaderText="تعداد استفاده" SortExpression="Used" UniqueName="Used">
        </telerik:GridBoundColumn>
        <telerik:GridBoundColumn Visible="false" DataField="Status" DataType="System.Byte"
            HeaderText="وضعیت" SortExpression="Status" UniqueName="Status">
        </telerik:GridBoundColumn>
        <telerik:GridBoundColumn DataField="Description" DataType="System.Byte"
            HeaderText="توضیحات" SortExpression="Description" UniqueName="Description">
        </telerik:GridBoundColumn>
         <telerik:GridBoundColumn DataField="LastEditDate" DataType="System.Byte"
            HeaderText="آخرین ویرایش" SortExpression="LastEditDate" UniqueName="LastEditDate">
        </telerik:GridBoundColumn>
        <telerik:GridBoundColumn DataField="LastEditor" DataType="System.Byte"
            HeaderText="آخرین ویرایشگر" SortExpression="LastEditor" UniqueName="LastEditor">
        </telerik:GridBoundColumn>
        <telerik:GridButtonColumn HeaderText="حذف محصول" ConfirmText="محصول مورد نظر حذف گردد؟"
                    ImageUrl="~/images/delete.png" ButtonType="ImageButton" ItemStyle-Width="30px"
                    CommandName="Delete" UniqueName="DeleteColumn" ConfirmDialogType="RadWindow"
                    ConfirmTitle="تایید حذف محصول" ItemStyle-BorderStyle="None">
                    <ItemStyle BorderStyle="None" Width="30px"></ItemStyle>
                    </telerik:GridButtonColumn>
        <telerik:GridButtonColumn HeaderText="ویرایش محصول"
                    ImageUrl="~/images/Edit.png" ButtonType="ImageButton" ItemStyle-Width="30px"
                    CommandName="Edit" UniqueName="EditColumn"
                    ItemStyle-BorderStyle="None">
                    <ItemStyle BorderStyle="None" Width="30px"></ItemStyle>
                    </telerik:GridButtonColumn>
            </Columns>
 
My DeleteColumn Is "DeleteColumn".Any One Can Help Me To Show Row Info  (ProductID) In Delete PopUp Confirmation?
Thanks

3 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 05 Jun 2012, 08:27 AM
Hi Pinco,

Try the following code to achieve your scenario.
C#:
void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e)
{
 if (e.Item is GridDataItem)
 {
   GridDataItem item = e.Item as GridDataItem;
   ImageButton btn = (ImageButton)item["DeleteColumn"].Controls[0];
   string val = item.GetDataKeyValue("ProductID").ToString();
   btn.Attributes.Add("onclick", "GetValue('" + val + "');return false;");
 }
}
JS:
function GetValue(id) {
radconfirm("Are you sure you to delete" + id + " ");
}

Thanks,
Princy.
0
Guru
Top achievements
Rank 1
answered on 05 Jun 2012, 08:53 AM

Hi,            
Find the below code for your reference,to delete confirmation message from template column.

 <telerik:GridTemplateColumn HeaderText="Actions" Groupable="false" AllowFiltering="false"
 ItemStyle-HorizontalAlign="Center" HeaderStyle-Width="10%" HeaderStyle-HorizontalAlign="Left"
 UniqueName="EditCommandColumn" ItemStyle-Wrap="false">
 <ItemTemplate>

<asp:LinkButton ID="lnkDelete" runat="server" CommandName="Delete" ToolTip="Delete"
CommandArgument='<%# Eval("CohortListId")%>' OnClientClick="return confirm('Are you sure you want to delete?')"
Text="<img border='0' src='../Images/Delete.gif' />"></asp:LinkButton>&nbsp;</ItemTemplate>

</telerik:GridTemplateColumn>

OR

 

<telerik:GridButtonColumn CommandName="Delete" ConfirmText="Are you sure you want to delete this row?"

HeaderStyle-Width="10%" HeaderText="Action" ItemStyle-HorizontalAlign="Left"

Text="<img border='0' title='Delete' src='../Images/Delete.gif'/>" UniqueName="DeleteCommandColumn">

</telerik:GridButtonColumn>
Thank you
Gurumoorthy

0
PINCO
Top achievements
Rank 1
answered on 06 Jun 2012, 04:25 AM
Very Thanks  Princy......
I Hope Success For You.
Tags
Grid
Asked by
PINCO
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Guru
Top achievements
Rank 1
PINCO
Top achievements
Rank 1
Share this question
or