Need Help Using a Web Service !

  1. #1

    Need Help Using a Web Service !

    I am trying to load Album Images from a webservice. Could someone point me in the correct direction ? Thanks in advance.


    AlbumCategoriesPage.aspx
                <ext:GridPanel ID="gp" runat="server" Region="Center" Border="false">
                    <Store>
                        <ext:Store ID="st" runat="server" OnBeforeStoreChanged="st_BeforeChanged" OnAfterStoreChanged="st_AfterChanged"
                            OnBeforeRecordInserted="st_BeforeInserted" OnBeforeRecordUpdated="st_BeforeUpdated"
                            OnBeforeRecordDeleted="st_BeforeDeleted">
                            <Proxy>
                                <ext:HttpProxy Method="GET" Url="../../AAAAWebService.asmx/GetAllAlbumCategory" />                            
                            </Proxy>
                            <Reader>
                                <ext:XmlReader Record="IV_AlbumCategory" IDPath="AlbumID">
                                    <Fields>
                                        <ext:RecordField Name="AlbumID" />
                                        <ext:RecordField Name="AlbumName" />
                                        <ext:RecordField Name="AlbumOrderBy" DefaultValue="0" />
                                        <ext:RecordField Name="AlbumTitle" />
                                        <ext:RecordField Name="AlbumKeyword" />
                                        <ext:RecordField Name="AlbumDescription" />
                                    </Fields>
                                </ext:XmlReader>
                            </Reader>
                           
                            <SortInfo Field="AlbumOrderBy" Direction="ASC" />
                            <Listeners>
                                <LoadException Handler="var e = e || {message: response.responseText}; alert('Load failed: ' + e.message);" />
                                <SaveException Handler="alert('Có lỗi xảy ra! Làm ơn thử lại hoặc liên hệ admin');" />
                                <CommitDone Handler="alert('Lưu thành công!');" />
                                <CommitFailed Handler="alert('Commit failed\nReason: '+msg)" />
                            </Listeners>
                        </ext:Store>
                    </Store>
                    <ColumnModel>
                        <Columns>
                            <ext:RowNumbererColumn>
                            </ext:RowNumbererColumn>
                            <ext:Column DataIndex="AlbumName" Header="Tên Album" Width="100">
                                <Editor>
                                    <ext:TextField runat="server" Text="" />
                                </Editor>
                            </ext:Column>
                            <ext:Column DataIndex="AlbumTitle" Header="Tiêu Đề" Width="100">
                                <Editor>
                                    <ext:TextField ID="TextField1" runat="server" Text="" />
                                </Editor>
                            </ext:Column>
                            <ext:Column DataIndex="AlbumKeyword" Header="Từ Khóa" Width="200">
                                <Editor>
                                    <ext:TextField ID="TextField2" runat="server" Text="" />
                                </Editor>
                            </ext:Column>
                            <ext:Column DataIndex="AlbumDescription" Header="Miêu Tả" Width="200">
                                <Editor>
                                    <ext:TextField ID="TextField3" runat="server" Text="" />
                                </Editor>
                            </ext:Column>
                            <ext:Column DataIndex="AlbumOrderBy" Header="Thứ tự" Align="Right" Width="100">
                                <Editor>
                                    <ext:NumberField runat="server" Text="0">
                                    </ext:NumberField>
                                </Editor>
                            </ext:Column>
                            <ext:CommandColumn Width="160" Align="Center" >
                                <Commands>
                                    <ext:GridCommand CommandName="UploadImage" Icon="TableEdit" Text="Upload hình cho Album">                                    
                                    </ext:GridCommand>
                                </Commands>
                            </ext:CommandColumn>
                        </Columns>
                    </ColumnModel>
                    <Listeners>
                        <Command Handler="window.navigate('AlbumImagesPage.aspx?albumid=' + record.data.AlbumID);"/>                    
                    </Listeners>
                    <SelectionModel>
                        <ext:CheckboxSelectionModel runat="server">
                        </ext:CheckboxSelectionModel>
                    </SelectionModel>
                    <Plugins>
                        <ext:RowEditor ID="RowEditor1" runat="server" SaveText="Update" />
                    </Plugins>
     </ext:GridPanel>

    AlbumImagesPage.aspx
    <ext:GridPanel ID="gp" runat="server" Region="Center" Border="false">
                    <Store>
                        <ext:Store ID="st" runat="server" OnBeforeStoreChanged="st_BeforeChanged" OnAfterStoreChanged="st_AfterChanged"
                            OnBeforeRecordInserted="st_BeforeInserted" OnBeforeRecordUpdated="st_BeforeUpdated"
                            OnBeforeRecordDeleted="st_BeforeDeleted">
                            <Proxy>
                                <ext:HttpProxy Method="GET" Url="../../AAAAWebService.asmx/GetAllAlbumImageByAlbumID" />                            
                            </Proxy>
                            <AutoLoadParams>
                                <ext:Parameter Name="albumid" Mode="Value" Value=""> 
                            </AutoLoadParams>
                            <Reader>
                                <ext:XmlReader Record="IV_AlbumImage" IDPath="ImageID">
                                    <Fields>
                                        <ext:RecordField Name="ImageID" />
                                        <ext:RecordField Name="ImageURL" />
                                        <ext:RecordField Name="ImageIsDefault" />
                                        <ext:RecordField Name="ImageIsActived" />                                    
                                    </Fields>
                                </ext:XmlReader>
                            </Reader>
                            <Listeners>
                                <LoadException Handler="var e = e || {message: response.responseText}; alert('Load failed: ' + e.message);" />
                                <SaveException Handler="alert('Có lỗi xảy ra! Làm ơn thử lại hoặc liên hệ admin');" />
                                <CommitDone Handler="alert('Lưu thành công!');" />
                                <CommitFailed Handler="alert('Commit failed\nReason: '+msg)" />
                            </Listeners>
                        </ext:Store>
                    </Store>
                    <ColumnModel>
                        <Columns>
                            <ext:RowNumbererColumn>
                            </ext:RowNumbererColumn>
                            <ext:Column DataIndex="ImageURL" Header="Đường Dẫn Hình" Width="300">
                                <Editor>
                                    <ext:FileUploadField ID="slideurl" runat="server" EmptyText="596 x 374"></ext:FileUploadField>
                                </Editor>
                            </ext:Column>
                            <ext:BooleanColumn DataIndex="ImageIsDefault" Header="Mặt Định" Align="Center"  >
                                <Editor>
                                    <ext:Checkbox ID="Checkbox1" runat="server"></ext:Checkbox>
                                </Editor>
                            </ext:BooleanColumn>
                            <ext:BooleanColumn DataIndex="ImageIsActived" Header="Hiển thị" Align="Center" >
                                <Editor>
                                    <ext:Checkbox ID="Checkbox2" runat="server"></ext:Checkbox>
                                </Editor>
                            </ext:BooleanColumn>
                        </Columns>
                    </ColumnModel>                
                    <SelectionModel>
                        <ext:CheckboxSelectionModel ID="CheckboxSelectionModel1" runat="server">
                        </ext:CheckboxSelectionModel>
                    </SelectionModel>
                    <Plugins>
                        <ext:RowEditor ID="RowEditor1" runat="server" SaveText="Update" />
                    </Plugins>
    </ext:GridPanel>

    WebService.cs
    [WebMethod]
    public List<SerializableEntity<IV_AlbumCategory>> GetAllAlbumCategory()
     {        
            return db.IV_AlbumCategories.ToList<IV_AlbumCategory, SerializableEntity<IV_AlbumCategory>>();
     }
     
     [WebMethod]
     public List<SerializableEntity<IV_AlbumImage>> GetAllAlbumImageByAlbumID(int albumid)
     {
            var items = (from records in db.IV_AlbumImages
                        where records.AlbumID == albumid
                         select records).ToList<IV_AlbumImage, SerializableEntity<IV_AlbumImage>>();
            return items;
     }
  2. #2
    Have you checked the samples?
    https://examples1.ext.net/#/GridPane...rting/Handler/
    https://examples1.ext.net/#/GridPane...ON_WebService/

    I should be fairly straight forward
    Check that your service is sending data in the correct json format

    I am using handlers as my webapp and the services are installed on two different servers

    hth/Peter
  3. #3
    Quote Originally Posted by plykkegaard View Post
    Have you checked the samples?
    https://examples1.ext.net/#/GridPane...rting/Handler/
    https://examples1.ext.net/#/GridPane...ON_WebService/

    I should be fairly straight forward
    Check that your service is sending data in the correct json format

    I am using handlers as my webapp and the services are installed on two different servers

    hth/Peter
    I will try one again. Thanks for help

Similar Threads

  1. [CLOSED] Web Service Render ASCX
    By PoloTheMonk in forum 1.x Legacy Premium Help
    Replies: 4
    Last Post: Apr 16, 2012, 12:25 PM
  2. [CLOSED] web service problem
    By speedstepmem2 in forum 1.x Legacy Premium Help
    Replies: 3
    Last Post: Nov 02, 2009, 9:18 AM
  3. Replies: 6
    Last Post: Jun 04, 2009, 12:58 PM
  4. Software as a service?
    By dbassett74 in forum Licensing
    Replies: 1
    Last Post: May 21, 2009, 3:02 PM
  5. [CLOSED] Need Help Using a Web Service with a Grid
    By iansriley in forum 1.x Legacy Premium Help
    Replies: 4
    Last Post: Dec 23, 2008, 9:15 AM

Posting Permissions