?
Solved

Get Bound Fields value of gridview to javascript function

Posted on 2011-05-10
6
Medium Priority
?
598 Views
Last Modified: 2012-05-11
     Hello experts,
                  I am trying to pass value of gridveiw  bound field to javascript.
                  To achieve it I attempted to use HyperlinkField
                   and pass js function call to DataNavigateUrlFormatString but it does not work
                  Please advise.
                  Thanks


            <asp:GridView ID="gvVendorDetails" runat="server" AutoGenerateColumns="false">
                            <Columns>
                                <asp:HyperLinkField DataNavigateUrlFields="SiteUtilizationID,Manager "
                                    DataNavigateUrlFormatString="javascript:test(FieldValue);" DataTextField="SiteUtilizationID"
                                    HeaderText="Site Utilization ID" />
                               
                                <asp:HyperLinkField DataNavigateUrlFields="SiteUtilizationID,Manager " 
                                    DataNavigateUrlFormatString"javascript:test(FieldValue);"
                                    DataTextField="Manager" HeaderText="Manager" />                                
                        </asp:GridView>
0
Comment
Question by:Vadim2004
5 Comments
 
LVL 9

Expert Comment

by:TonyReba
ID: 35731409
Try

DataNavigateUrlFormatString="test(FieldValue)"
0
 
LVL 13

Expert Comment

by:Rick
ID: 35731490
Something like this?!?
function GetCellValue() {

 var gridview = document.getElementById("<%= GridView1.ClientID %>");
 var gCell;

 if (grid.rows.length > 0) {
  for (i = 1; i < grid.rows.length-1; i++) {
      gCell = grid.rows[i].cells[0].InnerHtml;
      // Do Whatever
  }
 }
}

Open in new window

0
 

Author Comment

by:Vadim2004
ID: 35731624
TonyReba, rick  - thank you for quick response.
but, I was tryied -
DataNavigateUrlFormatString="test(FieldValue)"

Result this error:

Description: HTTP 404. The resource you are looking for (or one of its dependencies) could have been removed, had its name changed, or is temporarily unavailable.  Please review the following URL and make sure that it is spelled correctly.

Requested URL: /ETMProject/test();
0
 

Accepted Solution

by:
Vadim2004 earned 0 total points
ID: 35731979
Here is solution:
C#:
  protected void GridView_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        e.Row.Attributes.Add("onclick", "test()");
    }
HTML:
<asp:HyperLinkField DataNavigateUrlFields="SiteUtilizationID,Manager "
       DataNavigateUrlFormatString"#"
       DataTextField="Manager" HeaderText="Manager" />                                
</asp:GridView>
0
 
LVL 19

Expert Comment

by:Amandeep Singh Bhullar
ID: 37514219
This question has been classified as abandoned and is closed as part of the Cleanup Program. See the recommendation for more details.
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this Article, I will provide a few tips in problem and solution manner. Opening an ASPX page in Visual studio 2003 is very slow. To make it fast, please do follow below steps:   Open the Solution/Project. Right click the ASPX file to b…
ASP.Net to Oracle Connectivity Recently I had to develop an ASP.NET application connecting to an Oracle database.As I am doing it first time ,I had to solve several problems. This article will help to such developers  to develop an ASP.NET client…
In a question here at Experts Exchange (https://www.experts-exchange.com/questions/29062564/Adobe-acrobat-reader-DC.html), a member asked how to create a signature in Adobe Acrobat Reader DC (the free Reader product, not the paid, full Acrobat produ…
With just a little bit of  SQL and VBA, many doors open to cool things like synchronize a list box to display data relevant to other information on a form.  If you have never written code or looked at an SQL statement before, no problem! ...  give i…
Suggested Courses
Course of the Month16 days, 7 hours left to enroll

850 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question