Do not use on any
shared computer
August 20, 2008 03:44am pdt
 
[x]
Attachment Details

Link Button in Datagrid

Tags: datagrid, link, button
I am developing a web app using VB.NET , VS 2003 and SQL 2000 DB.

Currenlty  I am playing with datagrid. My datagrid gets populated with data from SQL DB and that works fine.

For necessary requirements, I had to add some link buttons columns to my datagrid, so each row of the datagrid has same link buttons.

When user clicks on a link button(s), my code gets the ID of that specific row and opens a new window and transfers value of that ID to be used as reference in the new window.
One of the soubroutine's code for this is:

Public Sub DEDR_LockInfo(ByVal Sender As Object, ByVal E As DataGridCommandEventArgs)
       
        'RETRIVE LoanID for a specific row
        Dim lblLoanID As Label = E.Item.FindControl("lblLoanID")
        Dim LoanID As Integer = CType(lblLoanID.Text, Integer)

        Server.Transfer("BrokerLockInfo.aspx?&trans_id=" + LoanID.ToString(), True)
    End Sub

So, this also works fine, considering that I am using following syntax in HTML view of datagrid

<asp:TemplateColumn HeaderText="Lock Info">
     <ItemTemplate>
        <asp:LinkButton id="linkbtnLock" Text="Lock Info" Runat="server"  CommandName="Edit">
        </asp:LinkButton>
    </ItemTemplate>
</asp:TemplateColumn>

and then in datagrid definition I specificy that
onEditCommand="DEDR_LockInfo"  will be run.

So, as you can see my link button is set to invoke built in Edit command function of the datagrid and then datagrid knows that when Edit is processed it will actually process DEDR_LockInfo subroutine.

This works fine. I have 3 other link buttons so I used up all other Datagrid's On.....Commands such as
onUpdateCommand, OnDeleteCommand, OnCancelCommand.

Now I have a need for 1 more Link Button to be added to datagrid with the same purpose as all others, but I do not know how to set that new link button to run for example the above same DEDR_LockInfo subroutine.

So, what I can use to force my new linkbutton that is inside the grid, to run a specific subroutine that is gathering ID of that specific row and passes it to the new window?
It must be able to handle
ByVal E As DataGridCommandEventArgs
becasue of
E.Item.FindControl("lblLoanID")  accessing.

Thank you in advance


Start your free trial to view this solution
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

Question Stats
Zone: Microsoft
Question Asked By: Terrace
Solution Provided By: cezarF
Participating Experts: 2
Solution Grade: A
Views: 157
Translate:
Loading Advertisement...
 
[+][-]Expert Comment by cezarF

Rank: Master

Expert Comment by cezarF:

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
 
[+][-]Author Comment by Terrace
Author Comment by Terrace:

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
 
[+][-]Author Comment by Terrace
Author Comment by Terrace:

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
 
[+][-]Expert Comment by cezarF

Rank: Master

Expert Comment by cezarF:

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
 
[+][-]Accepted Solution by cezarF

Rank: Master

Accepted Solution by cezarF:

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
 
[+][-]Expert Comment by cezarF

Rank: Master

Expert Comment by cezarF:

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
 
[+][-]Administrative Comment by TheLearnedOne

Rank: Genius

Administrative Comment by TheLearnedOne:

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
 
Loading Advertisement...
Open Discussion
Open Discussion
 
Comment by Computer101
Forced accept.

Computer101
EE Admin
 
 
20080723-EE-VQP-34 / EE_QW_2_20070628