Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
355
WebDataGrid TemplateDataField with asp:ImageButton and event rowselectionchanged
posted

Hi!

I have a problem with a webdatagrid as templatedatafield to use a function to display an image of the image is send to another form with the corresponding id. I normallyuse something like this:

Aspx

<ig:TemplateDataField Key="Editar" Header-Text="Editar" Width="40px">
<ItemTemplate>


<input id="btnenviarid" type="image" src="../Images/Editar.gif" />
</ItemTemplate>
</ig:TemplateDataField>

codebehind

myWebdatagrid.Behaviors.CreateBehavior<Selection>();
myWebdatagrid.Behaviors.Selection.CellClickAction = CellClickAction.Row;
myWebdatagrid.Behaviors.Selection.RowSelectType = SelectType.Single;

myWebdatagrid.Behaviors.Selection.SelectionClientEvents.RowSelectionChanged = "WebDataGrid1_RowSelectionChanged";

JavaScript

function WebDataGrid1_RowSelectionChanged(sender, e)
{

//my code
}

So I have no problem there. My problem arises when I have two images in different columanas since sent me to different forms so as to specify that no image is selected to thereby determine which form will go ...
try to invoke a JavaScript function directly from the image ... but it causes conflict and is causing the postback me and I return my datagrid no data or make a doPostBack then not update my other selected image id ...
I hope you can help me

<asp:ImageButton  ID="imgeditar" ImageUrl="~/Images/Editar.gif" runat="server" OnClientClick="editar()"/>

funciton editar()

{

//my code

}

  • 20255
    Offline posted

    Hello,

    Thank you for contacting us, and for your patience!

    As I understand you want to have ImageButtons into two different columns and on RowSelectionChanged to show a Image based on the ImageButton which is pressed?

    Could you please let me know what I am missing from your scenario, because I think that I don't understand clearly your question. Once I understand your requirements I will be able to help you further with this.

    Looking forward for your reply.