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

RefreshImage Url and AddNewUrl Issue

1 Answer 77 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Zafarul
Top achievements
Rank 1
Zafarul asked on 16 Nov 2008, 08:45 AM
I am facing some problem in radgrid control.

I want to remove refresh button url from grid header and shift addbuttonurl from left side to right side without using

Dir

=LTR

 

or

Dir

=RTL

Please suggest

Regards,
Ansari Zafarul Islam A M

 

1 Answer, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 17 Nov 2008, 06:28 AM
Hi,

One suggestion will be to use a CommandItemTemplate where you can place the desired controls at desired position in it and perform the operation. Another suggestion wil be to hide both AddNewRecord and refresh buttons and add one image and Linkbutton in the position of the Refresh button.

Here is the code for hiding the buttons from CommandItem.

CS:
 protected void RadGrid1_ItemCreated(object sender, GridItemEventArgs e) 
    { 
        if (e.Item is GridCommandItem) 
        { 
            //to hide the AddNewRecord and refresh button 
            GridCommandItem cmdItem = (GridCommandItem)e.Item; 
            cmdItem.FindControl("RebindGridButton").Visible = false
            cmdItem.FindControl("RefreshButton").Visible = false
            cmdItem.FindControl("InitInsertButton").Visible = false
 
            //to add the image and Linkbutton to in the right most position 
            Image img = new Image(); 
            img.ID = "Image12"
            img.ImageUrl = "~/RadControls/Skins/Hay/Grid/AddRecord.gif"
            LinkButton lnkbtn = new LinkButton(); 
            lnkbtn.ID = "LinkButton12"
            lnkbtn.Text = "AddNewRecord"
            lnkbtn.Click += new EventHandler(lnkbtn_Click); 
            cmdItem.Controls[0].Controls[0].Controls[0].Controls[1].Controls.Add(img); 
            cmdItem.Controls[0].Controls[0].Controls[0].Controls[1].Controls.Add(lnkbtn); 
 
        } 
    } 
     // to set the Grid in Insert mode
    void lnkbtn_Click(object sender, EventArgs e) 
    { 
        RadGrid1.MasterTableView.IsItemInserted = true
        RadGrid1.MasterTableView.Rebind(); 
    } 

Thanks
Shinu
Tags
Grid
Asked by
Zafarul
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Share this question
or