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

Move the refresh link to left - InMode Editing

7 Answers 226 Views
Grid
This is a migrated thread and some comments may be shown as answers.
soo
Top achievements
Rank 1
soo asked on 04 Jun 2008, 03:52 AM
Hi,

There is 2 links appear by default when we allow for In Mode editing works in radgrid, "Add new record" and "Refresh" link. "Add new record" will locate at left hand side of the grid while "Refresh" link will locate at right hand side of the grid.

May i know is it possible to move the "Refresh" link to left hand side too?

And how to do that?

Please advice.

Thanks.

Regards,
Soo

7 Answers, 1 is accepted

Sort by
0
Konstantin Petkov
Telerik team
answered on 04 Jun 2008, 07:17 AM
Hi soo,

You can customize the Grid CommantItem as per your requirements. Please, take a look at this demo where a complex CommandItemTemplate is implemented. You will find more useful info about the CommandItem in the docs here.

Best wishes,
Konstantin Petkov
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Shinu
Top achievements
Rank 2
answered on 04 Jun 2008, 12:16 PM
Hi Soo,

You can also try the following code snippet.

CS:
 protected void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e) 
    { 
        if (e.Item is GridCommandItem) 
        { 
            GridCommandItem cmditm = (GridCommandItem)e.Item; 
            LinkButton lnkbtn = (LinkButton)cmditm.FindControl("RebindGridButton"); 
            lnkbtn.Visible = false
            LinkButton lnkbtn1 = new LinkButton(); 
            lnkbtn1.ID = "LinkButton1"
            lnkbtn1.Text = "Refresh"
            TableCell cell = new TableCell(); 
            cell.ID = "Cell1"
            cell.Controls.Add(lnkbtn1); 
            cmditm.Controls.Add(cell); 
             
        } 
        
    } 


Thanks
Shinu.
0
soo
Top achievements
Rank 1
answered on 12 Jun 2008, 01:50 PM
Hi,

May i know what is id for Refresh and Add New Record? It will show this 2 links by automatically when i allow editing in mode.

I'm not successfull get the ID for Refresh and Add new record.

Please advice.

Thanks.

Regards,
Soo

0
Sebastian
Telerik team
answered on 12 Jun 2008, 01:59 PM
Hi soo,

The ids of the default [Add new record]/[Refresh] buttons are listed in the table of this documentation topic:

http://www.telerik.com/help/aspnet-ajax/grdlocalizingcommanditem.html

Best regards,
Stephen
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
soo
Top achievements
Rank 1
answered on 12 Jun 2008, 03:02 PM
Hi,

My code as below : -

If

TypeOf e.Item Is GridCommandItem Then

Dim cmditm As GridCommandItem = DirectCast(e.Item, GridCommandItem)

Dim lnkbtn As LinkButton = DirectCast(cmditm.FindControl("InitInsertButton"), LinkButton)

Dim lnkbtn1 As LinkButton = DirectCast(cmditm.FindControl("RebindGridButton"), LinkButton)

End If

I'm not able to assign the lnkbtn.visible = false, as no control was found.

May i know what wrong with my code.  Is it correct to do that?

Please advice.

Thanks.

Regards,
Soo

0
Shinu
Top achievements
Rank 2
answered on 13 Jun 2008, 06:51 AM
Hi Soo,

Give a try with the following code snippet and see whether it is working.

CS:
   protected void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e) 
    { 
        if (e.Item is GridCommandItem) 
        { 
            GridCommandItem cmditm = (GridCommandItem)e.Item; 
            LinkButton lnkbtn1 = (LinkButton)cmditm.Controls[0].Controls[0].Controls[0].Controls[0].Controls[1]; 
            lnkbtn1.Visible = false
 
            LinkButton lnkbtn2 = (LinkButton)cmditm.Controls[0].Controls[0].Controls[0].Controls[1].Controls[1]; 
            lnkbtn2.Visible = false
 
             
        } 
         
    } 


Thanks
Shinu.
0
Daniel
Telerik team
answered on 16 Jun 2008, 03:25 PM
Hello Soo,

These are IDs for the CommandItem buttons as mentioned before:

'Add New Record' button:
InitInsertButton - text
AddNewRecordButton - image

'Refresh' button:
RebindGridButton - text
RefreshButton - image

In order to hide the Refresh button (for instance), consider using the following approach:

If TypeOf e.Item Is GridCommandItem Then 
    Dim gci As GridCommandItem = TryCast(e.Item, GridCommandItem) 
 
    gci.FindControl("RefreshButton").Visible = False 
    gci.FindControl("RebindGridButton").Visible = False 
End If 
 

Furthermore, you may find this link helpful: Hide AddNew

Greetings,
Daniel
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
Tags
Grid
Asked by
soo
Top achievements
Rank 1
Answers by
Konstantin Petkov
Telerik team
Shinu
Top achievements
Rank 2
soo
Top achievements
Rank 1
Sebastian
Telerik team
Daniel
Telerik team
Share this question
or