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

Clientside how to postback a value in the grid...?

1 Answer 40 Views
Grid
This is a migrated thread and some comments may be shown as answers.
sitefinitysteve
Top achievements
Rank 2
Iron
Veteran
sitefinitysteve asked on 06 Jun 2010, 02:33 AM
I've got a linkbutton in my grid template, and it has a click event assigned.

How can I get a databound value back to my codebehinds click event?

Its using clientside binding, but no attributes that I give it in the rowdatabound event are posted back

Any idea?

1 Answer, 1 is accepted

Sort by
0
sitefinitysteve
Top achievements
Rank 2
Iron
Veteran
answered on 07 Jun 2010, 02:27 AM
Ok, nm I WAS doing it right, but missed a brace in my jQuery selector so the value wasn't going over :)

So for anyone else needing this...(using jQuery)
1) Create a HiddenField outside of the RadGrid
2) In the RowDataBound wire up a click event to the buttons
var commentLink = $(".vbCommentLink"'#' + item.get_id()); //Get the linkbutton ref 
 
commentLink.attr('itemid', dataItem["ID"]); //assign the key to a property on the linkbutton 
 
//Wire up a jQuery click event 
 commentLink.click(function () { 
        var hiddenField = $('[id$="clickedItemID"]'); //Get ref to hiddenfield 
        hiddenField.attr('value', $(this).attr('itemid')); //set the value of it 
    }); 


Tags
Grid
Asked by
sitefinitysteve
Top achievements
Rank 2
Iron
Veteran
Answers by
sitefinitysteve
Top achievements
Rank 2
Iron
Veteran
Share this question
or