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

[Solved] clicking linkbuttons within a radgrid which is within a panel bar

3 Answers 84 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Caroline
Top achievements
Rank 1
Caroline asked on 03 Jun 2009, 12:52 PM
Hello

Please could someone help me...I have a number of panel bars which are created on the fly...in each panel bar i have a radgrid with lists a loads of names, by each name i have two link buttons for 'view profile' and 'view details'.  basically i need to get to the link buttons and perform some actions but how can i get to know they have been clicked?

I have tried everything i can think of in the code behind but with no success I have tried

 

Public Sub RadPanelBar1_ItemClick(ByVal sender As Object, ByVal e As Telerik.Web.UI.RadPanelBarEventArgs) Handles RadPanelBar1.ItemClick

 

 

End Sub

to start with and added 

 

OnClientItemClicked

 

="RadPanelBar1_ItemClick" to my RadPanelBar but cant even get this to trigger...

please could someone help me as to how i can access these link buttons.

thanks so much

 

3 Answers, 1 is accepted

Sort by
0
Caroline
Top achievements
Rank 1
answered on 03 Jun 2009, 01:27 PM
Hi Sorry

I have worked out to call a javascript function which is good that works when i click, but from my linkbuttons i am trying to pass a USerID but when i do 

var

 

GetID= $find("<%= btnBIO.ClientID %>");

i get the error 
Name 'btnBIO' is not declared

btnBIO is a LinkButton within my RadGrid which is within my panel, the linkbutton has a commandargument passing the USERID which is the value i am needing to get...do i need to change my find bit to look in the panel first?

many thanks

 

 

 

 

 

0
Caroline
Top achievements
Rank 1
answered on 04 Jun 2009, 07:47 AM
sorry to keep posting but an getting there but am now really stuck on finding the id of the button i have clicked I cannot for the life of me work out how to find my imagebutton within my radgrid which is within my panel, pleease can someone help.

this is my code for the imagebutton.

<

 

asp:ImageButton ImageUrl='<%#Eval("BIOImage")%>' 

 

CommandArgument

 

='<%#Eval("BIOReviewerDetailID")%>'

 

 

 

 

 Width="18" Height="18" OnClientClick="RemoveBIO(); return false;" causesvalidation="false" ID="btnBIO" runat="server" />

that then call my javascript

 

<

 

script type="text/javascript">

 

 

 

 

 

function RemoveBIO()

 

 

{

 

 

var panelBar = $find("<%=RadPanelBar1.ClientID %>");

 

 

 

var oWnd = radopen("RemoveFiles.aspx?Type=2", "RadWindow2");

 

oWnd.center();

}

 

 

</script>
I have managed to find the RadPanel I think as i dont get errors now, but i just cannot work out how to find my imagebutton as somehow i need to get hold of the BIOReviewerDetailID, I dont have to pass it through the button maybe as a hidden field if easier but either way how can i find it within my radgrid?

sorry for keep posting but just cant find an answer anywhere have looked at the tutorials but just cant seem to do it client-side.

many many thanks

 

0
Sebastian
Telerik team
answered on 09 Jun 2009, 12:57 PM
Hello Caroline,

How to access server controls in grid templates on the client you can see from the sample project in the following code library thread:

Moveover, in your particular case you can get reference to the DOM element of the image button in the following way:

<asp:ImageButton ImageUrl='<%#Eval("BIOImage")%>' CommandArgument='<%#Eval("BIOReviewerDetailID")%>' Width="18" Height="18" OnClientClick="RemoveBIO(sender); return false;" causesvalidation="false" ID="btnBIO" runat="server" /> 
 
that then call my javascript  
 
<script type="text/javascript">   
 function RemoveBIO(sender)    
 {   
   var imageButton = sender;  
   var panelBar = $find("<%=RadPanelBar1.ClientID %>");   
   var oWnd = radopen("RemoveFiles.aspx?Type=2", "RadWindow2");   
   oWnd.center();   
 }  
</script>   
 

Kind regards,
Sebastian
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
Tags
Grid
Asked by
Caroline
Top achievements
Rank 1
Answers by
Caroline
Top achievements
Rank 1
Sebastian
Telerik team
Share this question
or