[x]
Posted via EE Mobile

Search, ask, and monitor your questions on the go with EE Mobile. Visit Experts Exchange from your mobile device and never be out of touch again.

Question
[x]
Attachment Details
[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!

9.1

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

Asked by cwickens in Programming for ASP.NET, Microsoft Visual Basic.Net, Visual Basic Programming

Tags: VB.NET, ASP.NET, gridview, nested, modal, from

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:
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:
<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>
 
Related Solutions
Keywords: Modal Dialoge from Nested Gridview, …
 
Loading Advertisement...
 
[+][-]04/29/08 08:15 AM, ID: 21463058Accepted Solution

View this solution now by starting your 30-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

About this solution

Zones: Programming for ASP.NET, Microsoft Visual Basic.Net, Visual Basic Programming
Tags: VB.NET, ASP.NET, gridview, nested, modal, from
Sign Up Now!
Solution Provided By: srivatsavaye
Participating Experts: 1
Solution Grade: A
 
[+][-]04/29/08 08:22 AM, ID: 21463123Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]04/29/08 08:33 AM, ID: 21463229Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]04/29/08 09:06 AM, ID: 21463558Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
 
Loading Advertisement...
20091021-EE-VQP-81 / EE_QW_2_20070628