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

ConfirmText for a grid button column in RadGrid

4 Answers 334 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Saranya
Top achievements
Rank 2
Saranya asked on 12 Jun 2009, 07:34 AM
Hi,

I want to add value for ConfirmText in run time. I have a ragdrid and gridbuttoncolumns. Of that first column is an image button and rest are some data from the db. On clicking that button in the grid, we can set a confirmtext in design time. But I need the text to be set during runtime in my C# code. Is that possible?

Thanks.
Saranya

4 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 12 Jun 2009, 08:49 AM
Hello Saranya,

You can set the confirm text for the GridButtonColumn programatically as shown below:
c#:
 foreach (GridColumn col in RadGrid1.MasterTableView.Columns) 
   { 
     if (col.UniqueName == "ButtonColumnUniqueName"
       { 
                    (col as GridButtonColumn).ConfirmText = "Are you sure you want to contine??"
       } 
   } 

Thanks
Princy.
0
Saranya
Top achievements
Rank 2
answered on 12 Jun 2009, 11:27 AM
Thanks.

This program need to be given in itemcommand event right?

0
Shinu
Top achievements
Rank 2
answered on 12 Jun 2009, 11:59 AM
Hi Saranya,

You can either try the above code in PreRender event or ItemCommand event of grid.

-Shinu.
0
Saranya
Top achievements
Rank 2
answered on 12 Jun 2009, 12:08 PM
I have code like this.
public void save()
{
                    if (condn == true)
                    {
                        do this....
                    }
                    else
                    {
                        GridButtonColumn b = (GridButtonColumn)dgGrid.Columns.FindByUniqueName("go");
                        b.ConfirmText = "some message";
                        Response.Redirect("an url");
                    }
}

If the condn fails,it is directly getting redirected to URL with out displaying the confirm message.

If I give the confirm text in design page, it is displaying message irrespective of the condition. But I want confirm msg to be displayed on condn failure.

Thanks.
Tags
Grid
Asked by
Saranya
Top achievements
Rank 2
Answers by
Princy
Top achievements
Rank 2
Saranya
Top achievements
Rank 2
Shinu
Top achievements
Rank 2
Share this question
or