Hi,
I am searching for a sollution for my RadGrid:
I`ve puted some data in a DataGrid, I`ve puted a column with image buttons, so that each row has a button!
Now i will set an event when the user is clicking the button.
In the Event I will navigate to an other page that is inside of my Application.
I will also give some infofrmations about the clicked row with.
The part inside the event will lock for Example like this:
This will not be the problem, but how i can create the Event???
I didn`t find any way to create an Event like that.
Thanks for your help!!
Michael
I am searching for a sollution for my RadGrid:
I`ve puted some data in a DataGrid, I`ve puted a column with image buttons, so that each row has a button!
Now i will set an event when the user is clicking the button.
In the Event I will navigate to an other page that is inside of my Application.
I will also give some infofrmations about the clicked row with.
The part inside the event will lock for Example like this:
Application[
"Example"
] = ExampleList.Where(exap => examp.id == ExampleList.selectedindex);
Server.Transfer(
"Example.aspx"
,
false
);
This will not be the problem, but how i can create the Event???
I didn`t find any way to create an Event like that.
Thanks for your help!!
Michael
3 Answers, 1 is accepted
0

Princy
Top achievements
Rank 2
answered on 11 Aug 2011, 08:22 AM
Hello MIchael,
You can attach event to ImageButton as shown below.
aspx:
C#:
Thanks,
Princy.
You can attach event to ImageButton as shown below.
aspx:
<
telerik:GridTemplateColumn
UniqueName
=
"ImageColumn"
>
<
ItemTemplate
>
<
asp:ImageButton
ID
=
"ImageButton1"
runat
=
"server"
onclick
=
"ImageButton1_Click"
/>
</
ItemTemplate
>
</
telerik:GridTemplateColumn
>
C#:
protected
void
ImageButton1_Click(
object
sender, ImageClickEventArgs e)
{
//code here
}
Thanks,
Princy.
0

Michael
Top achievements
Rank 1
answered on 11 Aug 2011, 08:41 AM
Hello Princy,
thanks for your quick answer, but in your code are the ImageButtons static but I don`t know the count of the Items in my Grid, so I can`t define them static my definison is like that:
I'am trying to do it like that:
But it still not works i earn this Error-Mesage by clicking the Button:
"Server Error in '/' Application.
Exception Details: System.ArgumentException: Invalid postback or callback argument. Event validation is enabled using <pages enableEventValidation="true"/> in configuration or <%@ Page EnableEventValidation="true" %> in a page. For security purposes, this feature verifies that arguments to postback or callback events originate from the server control that originally rendered them. If the data is valid and expected, use the ClientScriptManager.RegisterForEventValidation method in order to register the postback or callback data for validation.
Source Error:
Stack Trace:
Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.225 "
Can you tell me what I do false???
Thanks a lot!!
thanks for your quick answer, but in your code are the ImageButtons static but I don`t know the count of the Items in my Grid, so I can`t define them static my definison is like that:
<
telerik:RadGrid
ID
=
"Example"
runat
=
"server"
>
<
ClientSettings
EnableRowHoverStyle
=
"true"
>
<
Selecting
AllowRowSelect
=
"true"
/>
</
ClientSettings
>
<
MasterTableView
>
<
Columns
>
<
telerik:GridButtonColumn
DataTextFormatString
=
"Edit this {0}"
ButtonType
=
"ImageButton"
UniqueName
=
"column"
HeaderText
=
"Edit"
ItemStyle-HorizontalAlign
=
"Center"
HeaderStyle-HorizontalAlign
=
"Center"
CommandName
=
"Edit"
ImageUrl
=
"Edit.jpg"
>
</
telerik:GridButtonColumn
>
</
Columns
>
</
MasterTableView
>
<
SelectedItemStyle
CssClass
=
"SelectedItem"
/>
</
telerik:RadGrid
>
I'am trying to do it like that:
protected
void
Example_ItemCommand(
object
source, GridCommandEventArgs e)
{
if
(e.CommandName ==
"Edit"
)
{
//Application[
"Example"
] = ExampleList.Where(examp => examp.Description == Example.Rows[Example.SelectedIndex.Cells[3].Text]);
Server.Transfer(
"Edit.aspx"
,
false
);
}
}
But it still not works i earn this Error-Mesage by clicking the Button:
"Server Error in '/' Application.
Invalid postback or callback argument. Event validation is enabled using <pages enableEventValidation="true"/> in configuration or <%@ Page EnableEventValidation="true" %> in a page. For security purposes, this feature verifies that arguments to postback or callback events originate from the server control that originally rendered them. If the data is valid and expected, use the ClientScriptManager.RegisterForEventValidation method in order to register the postback or callback data for validation.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.Exception Details: System.ArgumentException: Invalid postback or callback argument. Event validation is enabled using <pages enableEventValidation="true"/> in configuration or <%@ Page EnableEventValidation="true" %> in a page. For security purposes, this feature verifies that arguments to postback or callback events originate from the server control that originally rendered them. If the data is valid and expected, use the ClientScriptManager.RegisterForEventValidation method in order to register the postback or callback data for validation.
Source Error:
An unhandled exception was generated during the execution of the current
web request. Information regarding the origin and location of the
exception can be identified using the exception stack trace below.
|
Stack Trace:
[ArgumentException: Invalid postback or callback argument. Event validation is enabled using <pages enableEventValidation="true"/> in configuration or <%@ Page EnableEventValidation="true" %> in a page. For security purposes, this feature verifies that arguments to postback or callback events originate from the server control that originally rendered them. If the data is valid and expected, use the ClientScriptManager.RegisterForEventValidation method in order to register the postback or callback data for validation.] System.Web.UI.ClientScriptManager.ValidateEvent(String uniqueId, String argument) +427 System.Web.UI.Control.ValidateEvent(String uniqueID, String eventArgument) +107 System.Web.UI.WebControls.ImageButton.RaisePostBackEvent(String eventArgument) +59 System.Web.UI.WebControls.ImageButton.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +39 System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +37 System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +87 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +4225 |
Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.225 "
Can you tell me what I do false???
Thanks a lot!!
0
Hi Michael,
The presented error is most probably due to databinding issues for the control. I suppose that you are directly setting the datasource for the control and calling DataBind(). Please, keep in mind that this is not a recommended approach. To make sure that the control is properly maintained, please use Advanced Databinding.
I hope this helps.
Regards,
Maria Ilieva
the Telerik team
The presented error is most probably due to databinding issues for the control. I suppose that you are directly setting the datasource for the control and calling DataBind(). Please, keep in mind that this is not a recommended approach. To make sure that the control is properly maintained, please use Advanced Databinding.
I hope this helps.
Regards,
Maria Ilieva
the Telerik team
Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.