Question : Gridview Update not saving.  Fields stay in edit mode.

I got a gridview that I added an UpdateCommand to.  When I click update, the record goes into edit mode.  When I click update, the page jump to the top, and does not save.  The record remains in edit mode.  

Any idea on what I'm missing here.  Code attached.  Thanks,

Justin
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:
199:
200:
201:
202:
203:
204:
205:
206:
207:
208:
209:
210:
211:
212:
213:
214:
215:
216:
217:
218:
219:
220:
221:
222:
223:
224:
225:
226:
227:
228:
229:
230:
231:
232:
233:
234:
235:
236:
237:
238:
239:
240:
241:
242:
243:
244:
245:
246:
247:
248:
249:
250:
251:
252:
253:
254:
255:
256:
257:
258:
259:
260:
261:
262:
263:
264:
265:
266:
267:
268:
269:
270:
271:
272:
273:
274:
275:
276:
277:
278:
279:
280:
281:
282:
283:
284:
285:
286:
287:
288:
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Metadata.aspx.cs" Inherits="Composer_Pages_Metadata" MasterPageFile="~/Composer_Pages/mpNOMENU.master"%>
<%@ Register Assembly="obout_Interface" Namespace="Obout.Interface" TagPrefix="cc2" %>
<%@ Register Assembly="obout_Calendar2_Net" Namespace="OboutInc.Calendar2" TagPrefix="obout" %>
<%@ Register Assembly="obout_EasyMenu_Pro" Namespace="OboutInc.EasyMenu_Pro" TagPrefix="oem" %>
<%@ Register Assembly="obout_Grid_NET" Namespace="Obout.Grid" TagPrefix="cc1" %>

<asp:Content ContentPlaceHolderID="ContentPlaceHolder1" runat="server">

<style type="text/css">
A:link {text-decoration: none; color:White;}
A:visited {text-decoration: none; color:White;}
A:active {text-decoration: none}
A:hover {text-decoration: none; color: black;}
</style>

<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>

<div id="liquid-round">
  <div class="top"><span></span></div>
    <div class="center-content">
    <div style="font-size:24px; color:#666666; margin-bottom:5px; font:'copperplate', 'Garamond', 'Helvetica', 'Helvetica  Neue',Helvetica,'Lucida Grande','Helvetica  Neue',Arial,sans-serif;">TRACK METADATA</div>

    <table width="100%" border="0">
      <tr>
        <td align="left">
            COMPOSER: <asp:Label ID="lblComposer" runat="server" Text=""></asp:Label> &nbsp; &nbsp;
            JOB/SHOW: <asp:Label ID="lblJob" runat="server" Text=""></asp:Label><br />        
        </td>
      </tr>
        <tr><td colspan="3" bgcolor="#5D7B9D"><b><font color="white">&nbsp; ADD METADATA 
            <div style="float:right; color:White; text-decoration:none;"><a href="Instructions.aspx">HELP &nbsp;</a></div></font></b>
            </td>
        </tr>
        <tr>
            <td >
            <table border="0" width="400">
                <tr>
                    <td><b>Track Title:</b></td>
                                        
                    <td><cc2:OboutTextBox ID="txtTrackTitle" runat="server" Text="" Width="200"></cc2:OboutTextBox>
                    <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ErrorMessage="Enter Track Title" ControlToValidate="txtTrackTitle">*</asp:RequiredFieldValidator>
                    </td>
                </tr>
                <tr>
                    <td><b>File Name:</b></td>
                    <td><cc2:OboutTextBox ID="txtFileName" runat="server" Text="" Width="200"></cc2:OboutTextBox>                        
                    <asp:RequiredFieldValidator ID="RequiredFieldValidator3" runat="server" ErrorMessage="Enter File Name" ControlToValidate="txtFileName">*</asp:RequiredFieldValidator>
                    </td>
                </tr>

                <tr>
                    <td><b>Length:</b></td>
                    <td>
                        <cc2:OboutTextBox ID="txtLength" runat="server" Text="" Width="150"></cc2:OboutTextBox>
                    </td>
                </tr>

                <tr>
                    <td><b>Genre:   
                    <td>
                        <cc2:OboutDropDownList ID="ddCategory" runat="server">
                        <asp:ListItem></asp:ListItem>
                        <asp:ListItem>Underscore</asp:ListItem>
                        <asp:ListItem>Commercial</asp:ListItem>
                        <asp:ListItem>Rock</asp:ListItem>
                        <asp:ListItem>Blues</asp:ListItem>
                        <asp:ListItem>Jazz</asp:ListItem>
                        <asp:ListItem>Classical</asp:ListItem>
                        <asp:ListItem>Orchestral</asp:ListItem>
                        <asp:ListItem>Country, Folk</asp:ListItem>
                        <asp:ListItem>World</asp:ListItem>
                        <asp:ListItem>Urban</asp:ListItem>
                        <asp:ListItem>Pop</asp:ListItem>
                        <asp:ListItem>Electronic</asp:ListItem>
                        <asp:ListItem>Other</asp:ListItem>
                        </cc2:OboutDropDownList>
                    </td>
                </tr>
                <tr>
                    <td><b>Sub-Genre:</b></td>
                    <td>
                        <cc2:OboutDropDownList ID="ddSubCategory" runat="server"></cc2:OboutDropDownList>
                    </td>
                </tr>
                <tr>
                    <td><b>Featured Instrument:</b></td>
                    <td>
                        <cc2:OboutTextBox ID="txtFeaturedInst" runat="server" Width="150"></cc2:OboutTextBox>
                    </td>
                </tr>

                <tr>
                    <td><b>Beats-Per-Minute:</b></td>
                    <td>                        
                        <cc2:OboutTextBox ID="txtBPM" runat="server" Text="" Width="80"></cc2:OboutTextBox>
                    </td>
                </tr>
              </table>
              </td>
              <td>
              <table border="0">
                <tr>
                    <td valign="top"><b>Description:</b></td>
                    <td>
                        <cc2:OboutTextBox ID="txtDescription" runat="server" Text="" TextMode="MultiLine" Width="300"></cc2:OboutTextBox>                        
                    </td>
                </tr>
                <tr>
                    <td valign="top"><b>Keywords:</b></td>
                    <td>
                        <cc2:OboutTextBox ID="txtKeywords" runat="server" Text="" TextMode="MultiLine" Width="300"></cc2:OboutTextBox>                        
                    </td>
                </tr>
                <tr>
                    <td><b>CD Title:</b></td>
                    <td>
                        <cc2:OboutTextBox ID="txtCDTitle" runat="server" Width="150"></cc2:OboutTextBox>
                    </td>
                </tr>

                <tr>
                    <td><b>Vocal or Instrumental:</b></td>
                    <td>
                    <cc2:OboutDropDownList ID="ddIsVocal" runat="server">
                        <asp:ListItem Text="Instrumental" Value="Instrumental"></asp:ListItem>
                        <asp:ListItem Text="Vocal" Value="Vocal"></asp:ListItem>
                    </cc2:OboutDropDownList>
                    </td>
                </tr>
            </table>

            </td> 
        </tr>            
        <tr>
            <td colspan="2" align="center">
              <asp:Button ID="Button1" runat="server" Text="Add Track Metadata" onclick="Button1_Click"/>
                <asp:ValidationSummary ID="ValidationSummary1" runat="server" />
            </td>
        </tr>
    </table>

<hr />

    <table width="100%" border="0">
        <tr><td colspan="3" bgcolor="#5D7B9D"><b><font color="white">&nbsp; HERE ARE YOUR METADATA'ed TRACKS FOR THIS JOB SO FAR</font></b></td></tr>
    </table>

    <table>
      <tr>
        <td align="left">
    <asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Always">  
    <ContentTemplate>           
    <asp:Panel ID="Panel1" runat="server" ScrollBars="Both" Height="300">
    <asp:GridView ID="gvTracks" runat="server" CellPadding="4" 
        DataSourceID="dsTracks" DataKeyNames="RecID" 
        AutoGenerateColumns="False" AllowPaging="True" 
        AllowSorting="True" BackColor="White" BorderColor="#3366CC" BorderStyle="None" 
        BorderWidth="1px">    
        
        <EmptyDataTemplate>
            <div style="width:900px;">
            You haven't updated the metadata for any tracks for this job yet. <br />
            Fill out the form above to add your new tracks.
            </div>
        </EmptyDataTemplate>
    
        <FooterStyle BackColor="#99CCCC" ForeColor="#003399" />
        <RowStyle BackColor="White" ForeColor="#003399" />
        <Columns>
            <asp:CommandField ShowEditButton="True" ShowDeleteButton="true" />
            <asp:BoundField DataField="TrackTitle" HeaderText="TrackTitle" 
                ReadOnly="False"  ItemStyle-Width="10%" SortExpression="TrackTitle">
            </asp:BoundField>
            
            <asp:BoundField DataField="Filename" HeaderText="Filename" ReadOnly="False"  
                ItemStyle-Width="20%" SortExpression="Filename">
                <ItemStyle Width="20%" />
            </asp:BoundField>


            <asp:BoundField DataField="Time" HeaderText="Length" ReadOnly="False" 
                ItemStyle-Width="5%" SortExpression="Time">
                <ItemStyle Width="5%" />
            </asp:BoundField>

            <asp:BoundField DataField="Category" HeaderText="Genre" ReadOnly="False" 
                ItemStyle-Width="5%" SortExpression="Category">
                <ItemStyle Width="5%" />
            </asp:BoundField>
            
            <asp:BoundField DataField="SubCategory" HeaderText="Sub-Genre" 
                ReadOnly="False" ItemStyle-Width="4%" SortExpression="SubCategory">
                <ItemStyle Width="4%" />
            </asp:BoundField>

            <asp:BoundField DataField="FeaturedInstrument" HeaderText="Featured Instrument" ReadOnly="False"  
                ItemStyle-Width="10%" SortExpression="FeaturedInstrument">
                <ItemStyle Width="10%" />
            </asp:BoundField>

            <asp:BoundField DataField="BPM" HeaderText="BPM" ReadOnly="False" 
                ItemStyle-Width="5%" SortExpression="BPM">
                <ItemStyle Width="5%" />
            </asp:BoundField>
            
            <asp:BoundField DataField="Description" HeaderText="Description" 
                ReadOnly="False" ItemStyle-Width="5%" SortExpression="Description">
                <ItemStyle Width="5%" />
            </asp:BoundField>
             
            <asp:BoundField DataField="Keywords" HeaderText="Keywords" ReadOnly="False" 
                ItemStyle-Width="5%" SortExpression="Keywords">
                <ItemStyle Width="5%" />
            </asp:BoundField>
            
            <asp:BoundField DataField="CDTitle" HeaderText="CDTitle" 
                SortExpression="CDTitle" />
            <asp:BoundField DataField="IsVocal" HeaderText="IsVocal" 
                SortExpression="IsVocal" />
        </Columns>
        <PagerStyle BackColor="#99CCCC" ForeColor="#003399" HorizontalAlign="Left" />
        <SelectedRowStyle BackColor="#009999" Font-Bold="True" ForeColor="#CCFF99" />
        <HeaderStyle BackColor="#003399" Font-Bold="True" ForeColor="#CCCCFF" />
    </asp:GridView>

    <asp:UpdateProgress ID="UpdateProgress1" runat="server" DisplayAfter="0">
        <ProgressTemplate>
            <div class="loading-image">
		        <img src="../images/musicsearch/2.gif" alt="loading">
	        </div>
        </ProgressTemplate>
    </asp:UpdateProgress>
    </asp:Panel>
    
    </ContentTemplate>
    </asp:UpdatePanel>

        </td>
      </tr>

    </table>


            
    <!-- Data Objects -->           
    <asp:SqlDataSource ID="dsTracks" runat="server" 
        ConnectionString="<%$ ConnectionStrings:SmashHausConnectionString %>" 
        SelectCommand="SELECT [RecID], [EntryDate], [TrackTitle], [Composer], [Filename], [FeaturedInstrument], [Popularity], [Time], [Description], [Category], [SubCategory], [Keywords], [BPM], [CDTitle], [IsVocal] FROM [metadata] WHERE [FirstName] like @qFirstName AND [LastName] like @qLastName AND [Job] like @qJob ORDER BY EntryDate desc"
        DeleteCommand="DELETE FROM metadata WHERE (RecID = @RecID)" 
        InsertCommand="INSERT INTO metadata(TrackTitle) VALUES (@TrackTitle)" 
        UpdateCommand="UPDATE metadata SET Filename =@Filename, Time = @Time, Description = @Description, Category =@Category, SubCategory =@SubCategory, Keywords =@Keywords, Composer =@Composer, BPM =@BPM, TrackTitle =@TrackTitle, CDTitle =@CDTitle, IsVocal =@IsVocal WHERE RecID = @RecID">

        <SelectParameters>
          <asp:QueryStringParameter Name="qFirstName" QueryStringField="fn" Type="String" />
          <asp:QueryStringParameter Name="qLastName" QueryStringField="ln" Type="String" />
          <asp:QueryStringParameter Name="qJob" QueryStringField="job" Type="String" />
        </SelectParameters>
        <DeleteParameters>
            <asp:Parameter Name="RecID" />
        </DeleteParameters>
        <UpdateParameters>
            <asp:ControlParameter ControlID="gvTracks" Name="RecID" PropertyName="SelectedValue" Type="Int32" />
            <asp:Parameter Name="Filename" />
            <asp:Parameter Name="Time" />
            <asp:Parameter Name="Description" />
            <asp:Parameter Name="Category" />
            <asp:Parameter Name="SubCategory" />
            <asp:Parameter Name="Keywords" />
            <asp:Parameter Name="Composer" />
            <asp:Parameter Name="BPM" />
            <asp:Parameter Name="TrackTitle" />
            <asp:Parameter Name="CDTitle" />
            <asp:Parameter Name="IsVocal" />
            <asp:Parameter Name="RecID" />
        </UpdateParameters>
        <InsertParameters>
          <asp:Parameter Name="TrackTitle" Type="String" />          
        </InsertParameters>
        
    </asp:SqlDataSource>

       <br /><br />
        </div>
        <div class="bottom"><span></span></div>
    </div>

</asp:Content>

Answer : Gridview Update not saving.  Fields stay in edit mode.

Problem is with:: myposter.load(file_still_URL);

To load image AS3:
-------------------------------------------------------
                  var loader:Loader = new Loader();
                  var urlRquest:URLRequest = new URLRequest(file_still_URL);
                  myposter.addChild(loader);
                  loader.load(urlRquest);
-------------------------------------------------------

Hope this will help.
Random Solutions  
 
programming4us programming4us