JavaScript - getting cell value using index value of grid in java script
Asked By mani
29-Jun-11 04:16 AM
hi..i am having gridview selected index value...but using that i need to access gridveiw cell value based on that index value...using javascript...any help???
James H replied to mani
Hi Please do like this
function fcnCheck() {
var grid = document.getElementById("<%= GridViewProducts.ClientID %>");
var theDropdown = grid.rows[i].cells[0].elements[0];
var selIndex = theDropdown.selectedIndex;
cellPivot = theDropdown.options[selIndex].value;
}
Another possibly easier or more reliable way to do this would be to tag the cells controls you want in some way and select them directly?
Ravi S replied to mani
HI
$(document).ready(function() {
var gvid = '<%=GridView1.ClientID %>';
$('#' + gvid + ' input[type=button]').removeAttr('onclick');
$('#' + gvid + ' input[type=button]').click(function() {
$('#' + gvid + ' tr').css('background-color', '#FFFFFF');
var row = $(this).parent().parent();
row.css('background-color', '#FFFF00');
var cells = row.find('td');
$('#Span1').html(cells[0].innerHTML);
$('#Span2').html(cells[1].innerHTML);
$('#Span3').html(cells[2].innerHTML);
$('#Span4').html(cells[3].innerHTML);
$('#Span5').html(cells[4].innerHTML);
$('#Span6').html(cells[5].innerHTML);
});
});
refer the link also
http://forums.asp.net/t/1635027.aspx
http://community.devexpress.com/forums/p/97621/334518.aspx
[ Kirtan ] replied to mani
use Jquery to do that
<script src="Scripts/jquery-1.3.2.js" type="text/javascript"></script>
<script type="text/javascript">
$(document).ready(function() {
var list = "";
$("#btnGet").click(function() {
$("#<%=GridView1.ClientID %> tr").each(function() {
//Skip first(header) row
if (!this.rowIndex) return;
var age = $(this).find("td:last").html();
list += age + "</br>";
});
$("#listAge").html(list)
});
});
</script>

Windows Photo Gallery Windows 7 Does anyone know how to change the background color in Windows Photo Gallery from the yellowish color to any other color? Thanks for any help, Skip Windows Media Discussions Windows Vista (1) XP (1) PhotoBlog (1) Gallery (1) Pix (1) = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = Have com / pix / pages / faq.aspx#q6 Read: "Q: Why do my photos have an odd color cast in the Photo Gallery (but look fine in the XP Picture and Fax Viewer it a try. keywords: Windows, Photo, Gallery description: Does anyone know how to change the background color in Windows Photo Gallery from the yellowish color to any other color Thanks for any
Calendar Background Color? Outlook I have a department that uses shared calendars from w / in each of their their Outlook 2007 client and they would like the calendars to be consistant in the color on each mailbox. As it stands now, they are different colors on all their clients I have tried making sure that they are opened in the same sequence (Debbie, Rick, Skip) but that doesn't seem to make a difference. Any ideas? Outlook Discussions Outlook (1) PC (1) Calendar (1) Color (1) Background (1) Calendars (1) Department (1) Consistant (1) Calendar color is a setting on the local PC and is not kept as part of the calendar data. - - Brian Tillman keywords: Calendar, Background, Color? description: I have a department that uses shared calendars from w / in each of
Change Background cell color depending on date and last value of c Excel ()My knowledge is in Access, but cell value, if the previous value of the cell was null or blank - change the background color to: If now() less (a date in the current column row 7) < = 30 yellow if the current column row 7) > = 30 Green else :if it had a value leave the color as is I have now spent a considerable time trying to accomplish this and am cell value, if the previous value of the cell was null or blank - change the background color to: If now() less (a date in the current column row 7) < = 30 yellow if the current column row 7) > = 30 Green else :if it had a value leave the color as is I have now spent a considerable time trying to accomplish this and am
StringWriter (); HtmlTextWriter hw = new HtmlTextWriter (sw); GridView1.AllowPaging = false ; GridView1.DataBind(); GridView1.HeaderRow.Style.Add( "background-color" , "#FFFFFF" ); GridView1.HeaderRow.Cells[0].Style.Add( "background-color" , "green" ); GridView1.HeaderRow.Cells[1].Style.Add( "background-color" , "green" ); GridView1.HeaderRow.Cells[2].Style.Add( "background-color" , "green" ); ArrayList arr = ( ArrayList )ViewState[ "States" ]; GridView1.HeaderRow.Cells[0].Visible = Convert .ToBoolean(arr[0
Joomla 1.6 Menu Items different color How do add different background color to every menu item in Joomla 1.6? Example: Main Menu 1Menu Item: About Company (background blue) 2Menu Item: Procucts (background green) 3Menu Item: Contact (background red) template.css [code] #leftbar-w {margin:0 0 20px 10px;padding:0px;width:195px module-title {font-size:16px;font-weight:100;margin:0;height:30px; line-height:30px; color: #fff; padding:0 0 0 23px; font-family:Tahoma, sans-serif; border-bottom:1px solid #f2f0ea;} #leftbar-w .module-title {background:#86B300 no-repeat left top; } #sidebar .module-body {margin:0; padding:5px 5px 5px 20px