The blog is created to discuss Prince2 methodology any issues faced in project management to be resolved or discussed and .Net Technology
Sunday, January 12, 2014
How to access a radio button selected Boundfield value from a GridView in javascript
function RefreshParent()
{
//get the gridview object
var gv = document.getElementById("grdViewBrand");
//get the gridview input object collection
var rbs = gv.getElementsByTagName("input");
//Traverse the input object collection
for (var i = 0; i < rbs.length; i++)
{
//Check for the checked radio button
if (rbs[i].type == "radio")
{
if (rbs[i].checked)
{
//get the bound field value from the position where check box is checked
// [i+1] is due to gridview dataBoundField includes header
row also which is not present in input collection
var brandName = gv.rows[i+1].cells[0].innerText;
break;
}
}
}
Description
Get the gridview object and its inputs elements.
Traverse through the (input)collection and get the
selected Radio Button row.
Now from the griview object get the rows position and the cell
and call its inner text property
Labels:
bound fields,
Gridview,
javascript,
radiobutton
Location:
Al Jubail Saudi Arabia
Subscribe to:
Posts (Atom)