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

[Solved] Need a link in radgrid to perform database functionality

4 Answers 76 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Amarinder Singh
Top achievements
Rank 1
Amarinder Singh asked on 27 Jan 2010, 11:45 AM
Hello, 

        I am using RadGrid. In RadGrid i need one link, onclick of which first i want to perform database activity and second  need to pop up window on the same. How to to do that.

Thanks

4 Answers, 1 is accepted

Sort by
0
Accepted
Shinu
Top achievements
Rank 2
answered on 27 Jan 2010, 12:14 PM
Hi Amarinder Singh,

You can add GridButtonColumn with custom CommandName and in the ItemCommand event, you can perform the database activity and then open the radwindow from code behind as shown below.

ASPX:
 
<telerik:RadWindowManager ID="RadWindowManager1" runat="server"
</telerik:RadWindowManager> 

CS:
 
    protected void RadGrid1_ItemCommand(object source, Telerik.Web.UI.GridCommandEventArgs e) 
    { 
        if (e.CommandName == "MyCommandName"
        { 
            // Your code 
 
            // Now open the window 
            RadWindow window1 = new RadWindow(); 
            window1.NavigateUrl = "http://www.google.com"
            window1.VisibleOnPageLoad = true
            RadWindowManager1.Windows.Add(window1); 
        } 
    } 

-Shinu.
0
Amarinder Singh
Top achievements
Rank 1
answered on 27 Jan 2010, 12:24 PM
Hi Shinu,

             Thanks for your comments.
0
Amarinder Singh
Top achievements
Rank 1
answered on 27 Jan 2010, 12:43 PM
Hello Shinu,

       I am struck with another problem. I am using  

<

 

telerik:GridButtonColumn FooterText="" DataTextFormatString="Approve"

 

 

UniqueName="approve" HeaderText="Approve" CommandName="MyCommandName" CommandArgument="" DataTextField="id">

 

 

<ItemStyle Width="100px" />

 

 

</telerik:GridButtonColumn>

On some condition i want to make this approve link disable and enable on  run time. How we can get this at link run time in 

 

OnItemDataBound.

 

 

Thanks
Amarinder

0
Accepted
Princy
Top achievements
Rank 2
answered on 27 Jan 2010, 01:30 PM
Hello Amarinder,

You can try out the following code to conditionally enable/disable the buttons in your grid:
c#:
 
protected void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e)  
    {  
        if (e.Item is GridDataItem)  
        {  
            GridDataItem dataItem = (GridDataItem)e.Item;  
            if (condition is satisfied) // your condition 
            {  
                ((LinkButton)dataItem["approve"].Controls[0]).Enabled = false;  
            }  
        }  
     }  

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