Question

Modal Dialoge from Nested Gridview, not quite there...

Asked by: cwickens

ok, I am pretty close to what I want but just missing that last little bit.  Basically, I have an image button in a nested gridview and I want to do an update statement when that button is hit.  The values that will be passed are going to be a session variable and the current date and time.  They will be passed into the record corresponding to the current row in the nested gridview.  

My plan is to have the Modal panel act as the confirm and when the user selects OK, the update will fire.

Make sense?  

Ok, here is what I have so far in the code behind.

Imports System
Imports System.Data
Imports System.Configuration
Imports System.Collections
Imports System.Web
Imports System.Web.Security
Imports System.Web.UI
Imports System.Web.UI.WebControls
Imports System.Web.UI.WebControls.WebParts
Imports System.Web.UI.HtmlControls
Imports System.Data.SqlClient

Partial Public Class sdb_Default
    Inherits BasePage


    Protected Sub gvCustomers_RowCreated(ByVal sender As Object, ByVal e As GridViewRowEventArgs)
        If e.Row.RowType = DataControlRowType.DataRow Then
            Dim ctrl As SqlDataSource = TryCast(e.Row.FindControl("sqlDsOrders"), SqlDataSource)
            If ctrl IsNot Nothing AndAlso e.Row.DataItem IsNot Nothing Then
                ctrl.SelectParameters("SDB_ID").DefaultValue = DirectCast(e.Row.DataItem, DataRowView)("SDB_ID")
            End If
        End If
    End Sub

   

    Private Shared ReadOnly conString As String
    Private sID As String
    Private vby As Int16 = Session("USERID")
    Shared Sub New()
        conString = WebConfigurationManager.ConnectionStrings("ToolBox").ConnectionString
    End Sub

    Protected Sub btnVerifyComponent_Click(ByVal sender As Object, ByVal e As EventArgs)
        Dim gvOrders As GridView = CType(gvCustomers.Rows(0).FindControl("gvOrders"), GridView)
        Dim con As New SqlConnection(conString)
        Dim cmd As New SqlCommand("UPDATE SDB_COMPONENT SET VERIFY_BY = @verby, DATE_VERIFY = GETDATE() WHERE SERNO = @serNO")
        Dim SerialNo As String

        For Each row As GridViewRow In gvOrders.Rows
            Dim iSN As Label = CType(row.FindControl("labelSerialNumber"), Label)
            SerialNo = iSN.Text.ToString
        Next



        cmd.CommandType = CommandType.Text
        cmd.Parameters.AddWithValue("@verby", vby)
        cmd.Parameters.AddWithValue("@serNO", SerialNo)

    End Sub



End Class


And the page:

<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
 
    <div align="center"><asp:Image ID="Image1" ImageUrl="~/images/sdb_searchbyUIC.png" runat="server" /></div>
    <asp:UpdatePanel ID="uicPanel" runat="server" UpdateMode="Conditional" Visible="true">
    <ContentTemplate>  <br />
<asp:Label ID="label_1" runat="server" CssClass="SHD">Enter a few characters of the UIC</asp:Label>
    <br />
<asp:TextBox ID="txtuicSearch" 
             runat="server" 
             Width="75px" ></asp:TextBox>
<asp:Button ID="search1" 
            runat="server" 
            Text="Search" />
    &nbsp;&nbsp;&nbsp;
<br />
    <cc1:AutoCompleteExtender ID="AutoCompleteExtender1" 
                              Enabled="true" 
                              MinimumPrefixLength="2" 
                              EnableCaching="true" 
                              runat="server" 
                              ServiceMethod="GetUICList" 
                              ServicePath="~/uicAutoComplete.asmx" 
                              TargetControlID="txtuicSearch" 
                              CompletionInterval="250">
    
    </cc1:AutoCompleteExtender>
    
    
 
    <asp:SqlDataSource ID="sqlDsCustomers" runat="server" ConnectionString="<%$ ConnectionStrings:ToolBox %>"
            SelectCommand="SELECT B.SDB_ID, A.COMMAND, A.UIC, A.UNIT, C.STAMIS_NAME , D.STAMIS_VERSION, C.LIN 
            FROM TB_CUSTOMER_INFO A INNER JOIN SDB_MASTER_RECORD B ON A.CUSTOMERID = B.CUSTOMERID 
            JOIN STAMIS C ON B.STAMIS_ID = C.STAMIS_ID 
            JOIN STAMIS_VERSION D ON B.STAMIS_VER_ID = D.VER_ID
            WHERE UIC LIKE @UIC + '%'
            ORDER BY A.COMMAND, C.STAMIS_NAME">
            <SelectParameters>
            <asp:ControlParameter ControlID="txtUICSearch" Name="UIC" />
            </SelectParameters>
        </asp:SqlDataSource>
        <div id="dlg" class="dialog" style="width: 1000px">
            <div align="right">
            <asp:HyperLink ID="HyperLink3" runat="server" ImageUrl="~/images/icons/back.png" ToolTip="Back to Search Page" NavigateUrl="~/sdb/autoComplete.aspx" />&nbsp;
            <asp:HyperLink ID="HyperLink4" runat="server" ImageUrl="~/images/icons/mainMenu.png" ToolTip="Return to Main Menu" NavigateUrl="~/tb_main_menu.aspx" /></div>
            </div>
            
            <div class="mainHeader" style="cursor: default">
                SDB Search Results: Components By UIC
            </div>
            <div class="body">
                <div class="SingleRightLine">
                    <div class="SingleLeftLine">
                        <div class="content">
                            <asp:Panel CssClass="grid" ID="pnlCust" runat="server">
                                <asp:UpdatePanel ID="pnlUpdate" runat="server">
                                    <ContentTemplate>
                                        <asp:GridView Width="100%" AllowPaging="True" ID="gvCustomers" AutoGenerateColumns="False"
                                            DataSourceID="sqlDsCustomers" runat="server" ShowHeader="False" OnRowCreated="gvCustomers_RowCreated">
                                           <EmptyDataTemplate>
                                             <div class="gridHeader">
                                                <div class="innerhead-mid">
                                                    <div class="group"><asp:Label ID="emptyMain" runat="server" CssClass="header" Text="No data is available, please search for a UIC above"></asp:Label></div>
                                                </div>
                                            </div>
                                           </EmptyDataTemplate>
                                            <Columns>
                                                <asp:TemplateField>
                                                    <ItemTemplate>
                                                        <div class="gridHeader">
                                                            <div class="innerhead-mid">
                                                               <asp:Table ID="headerTable" runat="server" Width="950px">
                                                                    <asp:TableRow Height="15px">
                                                                        <asp:TableCell><asp:Panel CssClass="group" ID="pnlCustomer" runat="server"><span class="header"><asp:Image ID="imgCollapsible" runat="server" ImageUrl="~/images/hide.png" Style="margin-right: 5px;" />UIC: <%#Eval("UIC")%>, UNIT: <%#Eval("UNIT")%> (STAMIS/VERSION: <%#Eval("STAMIS_NAME")%>/<%#Eval("STAMIS_VERSION")%>)</span></asp:Panel></asp:TableCell>
                                                                        <asp:TableCell Width="75px"><asp:ImageButton ToolTip="Request Modification" OnClientClick="alert('Request Modification of this record, Visible to CSSAMO and Administrators');return false;" ID="ImageButton4" runat="server" AlternateText="Request Modification" ImageUrl="~/images/icons/reqMod.png" Height="24px" Width="24px" /> &nbsp;<asp:ImageButton ToolTip="Edit Record" OnClientClick="alert('Edit this record, Visible to SCX, Admin');return false;" ID="ImageButton2" runat="server" AlternateText="Edit Record" ImageUrl="~/images/icons/edit.png" Height="24px" Width="24px" />
                                                                        </asp:TableCell>
                                                                    </asp:TableRow>
                                                                </asp:Table>
                                                            </div>
                                                        </div>
                                                        <asp:SqlDataSource ID="sqlDsOrders" runat="server" ConnectionString="<%$ ConnectionStrings:ToolBox %>"
                                                            SelectCommand="SELECT E.SDB_ID, E.TYPE, E.MAKE, E.MODEL, E.SERNO, E.DATE_ACPT, E.DATE_ISSUE, E.DATE_VERIFY, 
                                                            F.FNAME + ' ' + F.LNAME, E.DATE_ADDED, E.AGM_VER, E.COMP_ID
                                                            FROM SDB_COMPONENT E LEFT JOIN USER_INFO F ON E.VERIFY_BY = F.USERID
                                                            WHERE E.SDB_ID = @SDB_ID
                                                            ORDER BY E.SDB_ID, E.TYPE">
                                                            <SelectParameters>
                                                                <asp:Parameter Name="SDB_ID" Type="Int16" DefaultValue="" />
                                                            </SelectParameters>
                                                        </asp:SqlDataSource>
                                                        <asp:Panel Style="margin-left: 10px; margin-right: 5px" ID="pnlOrders" runat="server">
                                                            <asp:GridView AutoGenerateColumns="false" CssClass="grid" ID="gvOrders" DataSourceID="sqlDsOrders"
                                                                runat="server" ShowHeader="true" EnableViewState="false">
                                                                <RowStyle CssClass="row" />
                                                                <AlternatingRowStyle CssClass="altrow" />
                                                                <Columns>
                                                                    <asp:TemplateField ItemStyle-CssClass="rownum">
                                                                        
                                                                        <ItemTemplate>
                                                                            <asp:label ID="typelabel" runat="server" Text='<%#Eval("TYPE") %>'></asp:label>
                                                                        </ItemTemplate>
                                                                    </asp:TemplateField>
                                                                    
                                                                    <asp:BoundField HeaderText="MAKE" DataField="MAKE"  ItemStyle-Width="60px" />
                                                                    <asp:BoundField HeaderText="MODEL" DataField="MODEL" ItemStyle-Width="90px" />
                                                                    <asp:TemplateField><ItemTemplate><asp:Label ID="labelSerialNumber" runat="server" Text='<%#Eval("SERNO") %>' Visible="false"></asp:Label></ItemTemplate></asp:TemplateField>
                                                                    <asp:BoundField HeaderText="SERIAL NO." DataField="SERNO" ItemStyle-Width="90px" ItemStyle-HorizontalAlign="Right" />
                                                                    <asp:BoundField HeaderText="AGM VER." DataField="AGM_VER" ItemStyle-Width="70px" />
                                                                    <asp:BoundField HeaderText="ISSUE DATE" DataField="DATE_ISSUE" DataFormatString="{0:MM/dd/yyyy}" HtmlEncode="false" ItemStyle-Width="78px"/>
                                                                    <asp:BoundField HeaderText="ACCEPT DATE" DataField="DATE_ACPT" DataFormatString="{0:MM/dd/yyyy}" HtmlEncode="false"  ItemStyle-Width="83px"/>
                                                                    <asp:BoundField HeaderText="VERIFY DATE" DataField="DATE_VERIFY" DataFormatString="{0:MM/dd/yyyy}" HtmlEncode="false"  ItemStyle-Width="76px"/>
                                                                    <asp:BoundField HeaderText="VERIFY BY" DataField="" ItemStyle-Width="75px"/>
                                                                    <asp:TemplateField ItemStyle-Width="90px" HeaderText="ACTIONS">
                                                                        <ItemTemplate>
                                                                            <asp:ImageButton ID="btnVerifyComponent" ImageUrl="~/images/icons/reqMod.png" runat="server" OnClick="btnVerifyComponent_Click" />
                                                                            <asp:HyperLink ID="verifyIcon" ImageUrl="~/images/icons/verify.png" Height="24px" Width="24px" runat="server" ToolTip="Verify this component" /> 
                                                                            <asp:HyperLink ID="ftpIcon" NavigateUrl='<%#"update_ftp.aspx?COMP_ID=" & Eval("COMP_ID")%>' ImageUrl="~/images/icons/viewftp.png" Height="24px" Width="24px" runat="server" ToolTip="Update FTP information for this component" />
                                                                            <asp:HyperLink ID="C3Icon" NavigateUrl='<%#"add_to_3c.aspx?COMP_ID=" & Eval("COMP_ID")%>' ImageUrl="~/images/icons/applyTo3c.png" Height="24px" Width="24px" runat="server" ToolTip="Request exchange with 3C for this component" />
                                                                        </ItemTemplate>
                                                                    </asp:TemplateField>
                                                                    <asp:TemplateField>
                                                                        <ItemTemplate>
                                                                            <asp:HiddenField ID="hdn_sdbID" runat="server" Value='<%#Eval("SDB_ID") %>' visible="false" />
                                                                        </ItemTemplate>
                                                                    </asp:TemplateField>
                                                                </Columns>
                                                                <EmptyDataTemplate>
                                                                    <asp:Label runat="server" ID="noData" Text="There is nothing to display for this UIC"></asp:Label>
                                                                </EmptyDataTemplate>
                                                            </asp:GridView>
                                                        </asp:Panel>
                                                        <asp:Panel ID="pnlVerify" runat="server" CssClass="modalBox" Style="display:none" Width="500px">
                                                            <asp:Panel ID="VerifyCaption" runat="server" CssClass="caption" style="margin-bottom:10px; cursor:hand;">
                                                            Verify Component Information
                                                            </asp:Panel>
                                                            <asp:HiddenField ID="hidVerifyEditIndex" runat="server" Value="-1" />
                                                            
                                                            <div class="divCol">
					                                            Component Type</div>
				                                            <div class="divColLast">
					                                            <asp:Label ID="lblType" runat="server" AutoCompleteType="FirstName" MaxLength="64" Width="250" />
				                                            </div>
				                                            <div class="clearer">
				                                            </div>
				                                            
                                                            <div class="divCol">
					                                            Make</div>
				                                            <div class="divColLast">
					                                            <asp:Label ID="lblMake" runat="server" AutoCompleteType="FirstName" MaxLength="64" Width="250" />
				                                            </div>
				                                            <div class="clearer">
				                                            </div>
				                                            
                                                            <div class="divCol">
					                                            Model</div>
				                                            <div class="divColLast">
					                                            <asp:Label ID="lblModel" runat="server" AutoCompleteType="FirstName" MaxLength="64" Width="250" />
				                                            </div>
				                                            <div class="clearer">
				                                            </div>
				                                            
                                                            <div class="divCol">
					                                            Serial Number</div>
				                                            <div class="divColLast">
					                                            <asp:Label ID="lblSerialNumber" runat="server" AutoCompleteType="FirstName" MaxLength="64" Width="250" />
				                                            </div>
				                                            <div class="clearer">btnVerifyComponent
				                                            </div>
                                                            <div style="white-space: nowrap; text-align: center;">
					                                            <asp:Button ID="btnSavePerson" runat="server" Text="Save" OnClick="btnSavePerson_Click" CausesValidation="true"/>
					                                            <asp:Button ID="btnCancelPerson" runat="server" CausesValidation="false" Text="Cancel"/>
				                                            </div>
                                                        </asp:Panel>
                                                        
                                                        <cc1:CollapsiblePanelExtender id="cpe" runat="server" TargetControlID="pnlOrders"
                                                        CollapsedSize="0" Collapsed="true" ExpandControlID="pnlCustomer" CollapseControlID="pnlCustomer"
                                                        AutoCollapse="False" AutoExpand="False" ScrollContents="false" ImageControlID="imgCollapsible" 
                                                        ExpandedImage="~/images/show.png" CollapsedImage="~/images/hide.png" 
                                                        ExpandDirection="vertical" />
                                                        
                                                    </ItemTemplate>
                                                </asp:TemplateField>
                                            </Columns>
                                        </asp:GridView>
                                    </ContentTemplate>
                                </asp:UpdatePanel>
                            </asp:Panel>
                        </div>
                    </div>
                </div>
            </div>
            <div class="BottomBorder">
            </div>
        </div>
        
    </ContentTemplate>
    </asp:UpdatePanel>
    
</asp:Content>

                                  
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
63:
64:
65:
66:
67:
68:
69:
70:
71:
72:
73:
74:
75:
76:
77:
78:
79:
80:
81:
82:
83:
84:
85:
86:
87:
88:
89:
90:
91:
92:
93:
94:
95:
96:
97:
98:
99:
100:
101:
102:
103:
104:
105:
106:
107:
108:
109:
110:
111:
112:
113:
114:
115:
116:
117:
118:
119:
120:
121:
122:
123:
124:
125:
126:
127:
128:
129:
130:
131:
132:
133:
134:
135:
136:
137:
138:
139:
140:
141:
142:
143:
144:
145:
146:
147:
148:
149:
150:
151:
152:
153:
154:
155:
156:
157:
158:
159:
160:
161:
162:
163:
164:
165:
166:
167:
168:
169:
170:
171:
172:
173:
174:
175:
176:
177:
178:
179:
180:
181:
182:
183:
184:
185:
186:
187:
188:
189:
190:
191:
192:
193:
194:
195:
196:
197:
198:

Select allOpen in new window

This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.

Subscribe now for full access to Experts Exchange and get

Instant Access to this Solution

  • Plus...
  • 30 Day FREE access, no risk, no obligation
  • Collaborate with the world's top tech experts
  • Unlimited access to our exclusive solution database
  • Never be left without tech help again

Subscribe Now

Asked On
2008-04-28 at 17:30:16ID23360666
Tags

VB.NET, ASP.NET

,

gridview

,

nested

,

modal

,

from

Topics

Programming for ASP.NET

,

Microsoft Visual Basic.Net

,

Visual Basic Programming

Participating Experts
1
Points
500
Comments
4

Trusted by hundreds of thousands everyday for fast, accurate and reliable tech support.

  • "The time we save is the biggest benefit of Experts Exchange to Warner Bros. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange." Mike Kapnisakis, Warner Bros.
  • "Our team likes having a resource that is more secure than just using Google and most experts using this service really know their stuff. It's nice to look here first versus using Google." Dayna Sellner, Lockheed Martin
  • "Anytime that I've been stumped with a problem, 9 out of 10 times Experts Exchange has either the accepted solution or an open discussion of the potential solution to the problem." Kenny Red, eBay Inc.

See what Experts Exchange can do for you.

Got a question?

We've got the answer.

Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.

Screenshot of Experts Exchange Knowledgebase

Need individual assistance?

Our experts are ready to help.

If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.

Screenshot of Experts Exchange Knowledgebase

Want to learn from the best?

Read articles from industry experts.

Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.

Screenshot of an Article

Working on a long term project?

Store your work and research.

Save solutions to your questions, answers you’ve discovered through searching plus helpful articles in your personal knowledgebase for easy future access.

Screenshot of Experts Exchange Knowledgebase

Access the answers to your technology questions today.

Subscribe Now

30-day free trial. Register in 60 seconds.

What Makes Experts Exchange Unique?

Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Trusted by the world's most respected brands.

image of each brand's logo

Faithfully serving IT professionals since 1996.

Experts Exchange Logo

Try it out and discover for yourself.

Subscribe Now

30-day free trial. Register in 60 seconds.

Related Solutions

  1. Using SQLCommand object
    Hi Friends, I am maintaining and supporting a website which is ibuyspy portal I see following code in many of the vb files Dim myConnection As New SqlConnection(ConfigurationSettings.AppSettings("connectionString")) ' Generate Command Object based on Method Dim...
  2. How do you reference a gridview cell value in a VB codebe…
    I am using a link button in template field of a gridview to call a sub routine with its onclick event that sets a value in the SQL 2000 database, but I need to reference the "Convert.ToString(f.Row.Cells(0).Text).Trim()" in the WHERE clause of the SQL as it is the ...
  3. VB SQLConnection String
    I'm new to VB ADO. I copied an example code set from Northwind (see attached ), but it errors out on the line marked >>>. The first error says "source file is different then when module was built" Then after that "An error has occurred while establis...
  4. Add handler to embedded gridview
    I have embedded a gridview into another gridview. It works great except I want the user to be able to "select" a record in the child gridview and I can then display a details view. I am not sure how to get the "selectedindexchanged" onto the child gridv...
  5. Gridview Search
    I have a editable gridview that i am trying to search. I am looking to modify my code to do two additional things. I want to add a button on a couple of search fields that will filter the gridview. I have tried the FilterParameters but I am not entirely sure how to add the b...

Free Tech Articles

  1. WARNING: 5 Reasons why you should NEVER fix a computer for free.
    It is in our nature to love the puzzle. We are obsessed. The lot of us. We love puzzles. We love the challenge. We thrive on finding the answer. We hate disarray. It bothers us deep in our soul. W...
  2. SCCM OSD Basic troubleshooting
    SCCM 2007 OSD is a fantastic way to deploy operating systems, however, like most things SCCM issues can sometimes be difficult to resolve due to the sheer volume of logs to sift through and the dispe...
  3. Migrate Small Business Server 2003 to Exchange 2010 and Windows 2008 R2
    This guide is intended to provide step by step instructions on how to migrate from Small Business Server 2003 to Windows 2008 R2 with Exchange 2010. For this migration to work you will need the fo...
  4. Create a Win7 Gadget
    This article shows you how to create a simple "Gadget" -- a sort of mini-application supported by Windows 7 and Vista. Gadgets can be dropped anywhere on the desktop to provide instant information, ...
  5. Outlook continually prompting for username and password
    There have been a lot of questions recently regarding Outlook prompting for a username and password whilst using Exchange 2007. There are a few reasons why this would happen and I will try to cover t...
  6. Backup Exchange 2010 Information Store using Windows Backup
    There seems to be quite a lot of confusion around the ability to backup Exchange 2010 using the built in Windows Backup feature. This stems from the omission of this feature prior to Exchange 2007 s...

Cloud Class Webinars

  1. Avoiding Bugs in Microsoft Access
    Alison Balter takes and in-depth look at avoiding bugs in Access. In this webinar you will learn about using the immediate window to debug your applications, invoking the debugger, using breakpoints to troubleshoot, stepping through code, setting the next statement to execute, ...
  2. Top 10 Best New Features in Visio 2010
    Scott Helmers gives live demonstrations of the top 10 new features in Visio 2010. This webinar will teach you how to create compelling diagrams by adding shapes to the page with a single click, linking the shapes in a diagram to data in Excel (or SQL Server, or SharePoint), ...
  3. IT Consultant Business Secrets Revealed
    Michael Munger, Experts Exchange tech pro and IT consultant, pulls back the curtain on his very successful businesses and answers question on every IT consultant and business owner should know about. He shares secrets on what he did to solve the 5 most common problems in IT, ...
  4. Disaster Recovery and Business Continuity
    Quest CTO, Mike Billon, gives an overview of the steps involved in building a dunamic disaster recovery plan. Through case studies and an examination of software/hardware tooles for monitoring and testing, you'll gain a better understandin of where you are, where you want ...
  5. Organize Your Visio Diagrams with Containers and Lists
    Scott Helmers uses cross functional flowcharts, wireframe diagrams, data graphic legends and seating charts to teach you: how to ustilize all three new structured diagram components in Visio 2010, the best practices for organizeing shapes in previous version of Visio, how to organize ...
  6. How to Us Objects, Properties, Events and Methods in Microsoft Access
    Alison Dalter gives an in-depbth look at objects, properties, events and methods in Microsoft Access. In this webinar you will learn about using the object browser, referring to objects, working with properties and methods, working with object variables, understanding the ...

Join the Community

Give a Little. Get a Lot.

Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.

Join the Community

Answers

 

by: srivatsavayePosted on 2008-04-29 at 08:15:31ID: 21463058

why not use a plain javascript confirm dialog box?

 

by: cwickensPosted on 2008-04-29 at 08:22:37ID: 21463123

That would be fine, the issue I am having is passing (or retrieving) the value from the nested gridview.  

 

by: srivatsavayePosted on 2008-04-29 at 08:33:25ID: 21463229

Are the values you are trying to pass bound to the gridview? If yes, you can make use of the datakeynames property of the grid

 

by: cwickensPosted on 2008-04-29 at 09:06:25ID: 21463558

Thanks to your suggestion,  I solved the problem!

I changed the image button to have a command argument and the code behind  to receive the command arguments from the image button.  Then I just put the confirmButtonExtender on the button.

Here is the code in case anyone else needs it.  

I gave you the points since that put me on the right track.

Thanks!
c

                                                                           

<asp:ImageButton ID="btnVerifyComponent" ImageUrl="~/images/icons/reqMod.png" runat="server" OnCommand="btnVerifyComponent_Click" CommandName="verify" CommandArgument='<%#Eval("SERNO") %>' />
<cc1:ConfirmButtonExtender ID="confirmVerifyBtn" runat="server" TargetControlID="btnVerifyComponent" ConfirmText="Are you sure you want to confirm this components information is correct?" />
                                                                            
 
 
Private Shared ReadOnly conString As String
    Private vby As Int16 = Session("USERID")
    Shared Sub New()
        conString = WebConfigurationManager.ConnectionStrings("ToolBox").ConnectionString
    End Sub
 
    Protected Sub btnVerifyComponent_Click(ByVal sender As Object, ByVal e As CommandEventArgs)
        'Dim btnVerifyComponent As Button = TryCast(sender, Button)
        Dim gvOrders As GridView = CType(gvCustomers.Rows(0).FindControl("gvOrders"), GridView)
        'Dim row As GridViewRow = DirectCast(btnVerifyComponent.NamingContainer, GridViewRow)
 
 
 
 
        Dim SerialNo As String
        
        SerialNo = e.CommandArgument.ToString
 
        Dim con As New SqlConnection(conString)
        Dim cmd As New SqlCommand("UPDATE SDB_COMPONENT SET  DATE_VERIFY = GETDATE(), VERIFY_BY = @vby WHERE SERNO = @serNO", con)
        cmd.CommandType = CommandType.Text
        cmd.Parameters.AddWithValue("@serNO", SerialNo)
        cmd.Parameters.AddWithValue("@vby", vby)
        Using con
            con.Open()
            cmd.ExecuteNonQuery()
            con.Close()
 
 
        End Using
        gvOrders.DataBind()
 
 
    End Sub

                                              
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:

Select allOpen in new window

20120131-EE-VQP-002

3 Ways to Join

30-Day Free Trial

The Experts

98% positive feedback on 31,087 answers since March 2000. angeliii is a Microsoft Most Valuable Professional for his work with MS SQL Server & Develoment.

He has also proven his knowledge of Visual Basic Programming, PHP Scripting and Oracle Databases.

The Experts

97% positive feedback on 10,752 answers since July 2000. lrmoore has more than 18 years experience in the networking industry.

The six-time Mircosoft MVPs specialties include firewalls, virtual private networking, and network management.

Testimonials

"...and excellent source for support... Kind of like having your very own IT dept." Electriciansnet

Testimonials

"I was apprehensive at signing up at first. However... it has already made my life as an IT administrator much easier." JaCrews

Testimonials

"WOW! You guys have great, active, and knowledgeable people on here." moore50

Business Clients

Business Clients

In the Press

"If you’ve got a question... Experts Exchange can supply an answer.”

In the Press

"...an invaluable aid for both IT professionals and those who require tech support."

In the Press

"where IT professionals provide quick answers on just about any topic"

Business Account Plans

Loading Advertisement...