.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

Passing an ID from a hyperlink in a gridview

Posted By:      Posted Date: September 02, 2010    Points: 0   Category :ASP.Net
I have  gridview that lists a column of hyperlinked names.  A procedure is passed to get the data for the gridview.  I am also pulling an ID to use once the name is clicked.  Once clicked the ID is used in another procedure to populate a formview.  I am having a problem getting the ID to be associated to each hyperlink name in the column and figuring out how I am going to grab the ID from the asp:hyperlinkfield and then assigning it a variable to use elsewhere.  Any ideas?  Right now I trying to create a datarow with a new attribute.  Protected Sub grdvSearchlist_RowDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles grdvSearchlist.RowDataBound If e.Row.RowType = DataControlRowType.DataRow Then Dim dvr As Data.DataRowView Dim dataItem As Data.DataRowView = e.Row.DataItem dvr = dataItem e.Row.Attributes.Add("argID", dvr(0).ToString()) End If End Sub  

View Complete Post

More Related Resource Links

Passing multiple parameter in NavigateUrl (hyperlink) in GridView




Have created a gridview with a hyperlink column (in template)  in it.

I need to pass 3 or 4 values to the web form by clicking hyperlink column in gridview.


I have managed to pass a single value to web form.



<asp:HyperLink Runat="server" ID="hlDividents" NavigateUrl='<%# Eval("Dividents", "TreatyRuleDetail.aspx?Rate={0}") %>' Text='<%# Eval("Dividents") %>

How To display image in GridView as hyperlink


Hello Everyone 

Could someone please help me with a little issue....

I was able to save the image in the database as binary....... but now i don´t know how to display it in the GridView as a hyperlink.

I´ve read something about ImageField..... I´d appreciate any help .


Gridview hyperlink field

Hi I have a gridview that has two fields. Both fields are databound...but the one field is a hyperlink field which works fine...but I would like to add a Request.QueryString value to the the value retrieved from the database when setting the navigateurl property. Help would be much appreciated

Passing Multiple Parameters in NavigateURL Property of Hyperlink

In ASP.NET 3.5, is this the only way to pass Multiple Parameters in NavigateURL Property of Hyperlink ? What about using the HyperlinkField?<asp:TemplateField HeaderText="Form Name">    <ItemTemplate>        <asp:HyperLink ID="HyperLink2" runat="server"         NavigateUrl='<%# "~/Application/" + Eval("FormType") + ".aspx?FormID=" + Eval("FormID") %>'         Text='<%# Eval("FormName") %>'>                </asp:HyperLink>     </ItemTemplate></asp:TemplateField>

Hyperlink in GridView

I have a GridView with the bounded Fields "ProductNumber" and "FilePath". The idea is to select a product from a row and to open the corresponding PDF from the file path in a new window via target=_blank, I have already searched via Google but I didn't find anything thats suitable. Something like this doens't works:<asp:TemplateField> <ItemTemplate> <asp:HyperLink ID="link" runat="server" datatextfield="ProductNumber" NavigateUrl="<%# FilePath %>">"</asp:HyperLink> </ItemTemplate> </asp:TemplateField>   I hope someone can help me. Thanks!  

convert column into hyperlink in gridview

hi how can i convert column in grid view into hyperlink  thanks

make onle specific cells in gridview as hyperlink

Dear all,   i have gridview and im displaying the employement history of employee. and im providing a hyperlink in empid to open employee page with update mode ..so that user can update the record. i have an issue here.only if the employeeresigned = "N" empid should be hyperlink, if its "Y" it should not be a hyperlink. How to do this.  <asp:TemplateField HeaderText="empid" SortExpression="empid">   <ItemTemplate> <asp:LinkButton ID="LinkButton1" runat="server" OnCommand ="empDetails_disp" Text='<%# Eval("empid") %>' CommandArgument='<%# Eval("empid", "{0}") %>' ForeColor="#0000C0"></asp:LinkButton> </ItemTemplate> </asp:TemplateField> am wondering how to do this 1) shall i replace all the linkbutton with label if the resignedstatus = "Y" - how to do this? 2) or shall i make the empid as boundfields instead of templatefields and write code on rowbound...with checkin that if resigned = "Y" then e.Row.Cells(0).BackColor = Drawing.Color.blue  e.Row.Cells(0).Attributes.Add("onclick", "empDetails_disp")  e.Row.Cells(0).Attributes.Add("class", "statusclass") ...... in this case i can use only javascript fu

Gridview itemtemplate hyperlink

Can any help me I am facing a problem where I have to  set  Gridview itemtemplate hyperlink dynamically. Thanks

Passing Querystring Value into Gridview/Listview

I have a master-detail page consisting of a databound GridView and ListView. It's pretty standard - when you select a row in the GridView is shows up the ListView. The problem I'm running into is when I want to link to that page with a specific row pre-selected in both views. It seems like it should be easy enough, but I just can't figure it out. Currently, the ListView is connected to the GridView with a ControlParameter in the SelectCommand. Any assistance would be greatly appreciated. (Let me know if you need more info.)

Hyperlink in GridView



           Here is my html

            <asp:HyperLink runat="server" ID="HyperLink1" NavigateUrl='<%# string.Format("Tiff.aspx?ID={0}", Eval("ID")) %>' Target="_blank" Text="View" ></asp:HyperLink>

I m getting an exception Like This..

DataBinding: 'System.Collections.Hashtable' does not contain a property with the name 'ID'.

Clicking a GridView hyperlink to go to another WizardStep


Within a WizardStep in the AccountManagement.aspx page, I have the following Gridview:

                            <asp:GridView ID="GridViewUserAccounts" 
                                <AlternatingRowStyle BackColor="#EEEEEE" />
                                    <asp:HyperLinkField DataNavigateUrlFields="UserName" DataTextField="UserName" 
                                        HeaderText="User ID" />
                                    <asp:BoundField DataField="Email" HeaderText="Email" />

When a UserName HyperLinkField is clicked, I want to go to the another WizardStep.

With DataNavigateUrlFormatString="AccountManagement.aspx?user={0}, I think the page

Gridview Checkbox passing to new page


Hi Everyone,

I have searched and searched and unable to find an easy to understand answer with a sample of what I am after. Apologies I am new to ASP and programming VB. Please be gentle.


I have a web form and a gridview. The gridview is populated connecting to a SQL database. This populates ID, Name, Email. I have included a checkbox in the gridview using a template field. This is all good.

The problems becomes very complex to me when I want to select the IDS from the checkbox and with a click of a button on the webpage to send the selected ID to a new page. This new page will display the same gridview but only with selected data.


All you gurus out there, please assist with a VB sample (Design and Behind the code).


Thank you again geniusesss.


Passing two Values From GridView to Javascript



In this datelastmodified is Datagrid Column Name. I m displaying that column value in DIV. Now, I want to display another column Value in that DIV. that column name is Document Type. May I know how to pass that value.

<script type="text/javascript">
    function onRecordSelect(DateLastModified)
        var DocumentType;
        var date;
        for(var i=0; i<DateLastModified.length; i++)
              var record = DateLastModified[i];
              date += record.DateLastModified;
        var oDiv = document.getElementById("divSelectedRecords");
        oDiv.innerHTML =  date;

Inplace Edit in GridView

In this article I am presenting a different way to look at EditItemTemplate, using which user navigation for editing is reduced and . it looks very different (see screeen shots) then regular implementation of GridView.

GridView Confirmation Box Using JQuery BlockUI in asp.net

JQuery is the most popular JavaScript library. One of the main reasons for its fame is the plugin architecture. Anyone can create a separate library that leverage the JQuery library. In this article we are going to look at the BlockUI library which is used to block the user screen while performing a task.

Textbox Editable GridView in ASP.NET

This article describes how I made a fully editable gridview in C# using ASP.NET 2. The idea is that the GridView looks and works like an Excel spreadsheet. You see all the cells in the table, and you can edit any of the cells you like, and they are automatically updated (i.e. saved to the database). This is very often how people expect data tables to work in web pages, and I've often seen people clicking in vain on un-editable gridview cells, somehow expecting to edit them, and not understanding that they need to click an Edit button at the end of the row.

Adding Dynamic Rows in ASP.NET GridView Control with TextBoxes and with Delete functionality

In my previous examples, I have demonstrated on how to add dynamic rows in GridView control with TextBoxes and how to save the values into the database. Now, seems that most of the developers are asking if how to add a delete functionality with it. So in this example, I'm going to show on how to delete a certain row in the dynamic GridView with TextBoxes.
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend