Products

Solutions

Resources

Partners

Community

Blog

About

QA

Ideas Test

New Community Website

Ordinarily, you'd be at the right spot, but we've recently launched a brand new community website... For the community, by the community.

Yay... Take Me to the Community!

Welcome to the DNN Community Forums, your preferred source of online community support for all things related to DNN.
In order to participate you must be a registered DNNizen

HomeHomeArchived Discus...Archived Discus...Developing Under Previous Versions of .NETDeveloping Under Previous Versions of .NETASP.Net 2.0ASP.Net 2.0 Setting ObjectDataSource Select Method Programatically Setting ObjectDataSource Select Method Programatically
Previous
 
Next
New Post
4/20/2006 7:45 AM
 
Hi,
    Posted this thread on ASP.Net but have had no answers as yet, hopefully someone can assist me as i am now at a dead end...
Overview is I am trying to return a filtered set of data dependant upon a column selection and then giving a partial entry of whats required i.e. Column = CourseID, Search Expr = "ms"

I have had partial success by adding a second objectdatasource and connecting it to my business logic using the code below:

<Code>
Sub BindData(ByVal myCol As String, ByVal myFilter As String, ByVal myInt As Integer)
            Try
                If myCol = "" And myInt = 1 Then
                    GridView1.DataSourceID = ""
                    GridView1.DataSource = ObjectDataSourceCRS
                    GridView1.DataBind()
                End If
                If myCol = "CourseID" Then
                    GridView1.DataSourceID = ""
                    GridView1.DataSource = ObjectDataSource1
                    GridView1.DataBind()
                End If

            Catch exc As Exception        'Module failed to load
                ProcessModuleLoadException(Me, exc)
            End Try
        End Sub
<\Code>

This has caused some other issues:
1. The returned filter only shows one record, when infact it should show more (why one???)
2. When resetting the filter to show all records the paging function fails with the following error:
<error>
A critical error has occurred.
The GridView 'GridView1' fired event PageIndexChanging which wasn't handled.
</error>

I am getting closer to resolving this, assitance in sorting the above errors would be greatly appreciated.

Regards..
Peter.

 
New Post
4/20/2006 8:58 AM
 

Can you post the complete code of the .ascx file as well?

 


Thanks,
Vladan Strigo
NETMedia

My website: Vladan.Strigo.NET

Vladan.Strigo.NET: Projects
* Advanced VS2005 development approach - BlankModule
* DNN & Microsoft Ajax best practices guidance

Vladan.Strigo.NET: Resources
* Comprehensive list of DNN 4 Module development resources

 
New Post
4/20/2006 5:30 PM
 
Vladan,
      Here's the aspx code as requested..

<ascx start>

<%@ Control language="vb" Inherits="HomeProd.Modules.Tmgr_CourseType.ViewTmgr_CourseType" CodeFile="ViewTmgr_CourseType.ascx.vb" AutoEventWireup="false" Explicit="True" %>
<%@ Register TagPrefix="dnn" TagName="Audit" Src="~/controls/ModuleAuditControl.ascx" %>
<table cellspacing="0" style="text-align: left">
    <tr>
        <td>
            <p align="center">
                <font color="maroon" size="4"><strong>Filter On</strong></font>
            </p>
        </td>
        <td>
            <p align="center">
                <font color="maroon" size="4"><strong>Text to Filter On</strong></font>
            </p>
        </td>
        <td>
        </td>
    </tr>
    <tr>
        <td>
            <div align="center">
                <asp:DropDownList ID="DDLCol" runat="server">
                </asp:DropDownList></div>
        </td>
        <td>
            <div align="center">
                <asp:TextBox ID="txtFilter" runat="server" Width="129px"></asp:TextBox></div>
        </td>
        <td>
            &nbsp;
            <asp:Button ID="btnFilter" runat="server" OnClick="btnFilter_Click" Text="Filter" />
            &nbsp;<asp:Button ID="btnClear" runat="server" OnClick="btnClear_Click" Text="Reset" />
            &nbsp;</td>
    </tr>
</table>
&nbsp;&nbsp;&nbsp;
<asp:GridView ID="GridView1" runat="server" CellPadding="4" ForeColor="#333333" GridLines="Vertical" AllowPaging="True" AutoGenerateColumns="False" Font-Size="Smaller" DataSourceID="ObjectDataSourceCRS">
    <FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
    <RowStyle BackColor="#EFF3FB" />
    <EditRowStyle BackColor="#2461BF" />
    <SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
    <PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" />
    <HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
    <AlternatingRowStyle BackColor="White" />
    <Columns>
        <asp:BoundField DataField="CourseID" HeaderText="CourseID" SortExpression="CourseID" />
        <asp:BoundField DataField="CourseName" HeaderText="CourseName" SortExpression="CourseName" />
        <asp:BoundField DataField="CourseVendor" HeaderText="CourseVendor" SortExpression="CourseVendor" />
        <asp:BoundField DataField="ModuleID" HeaderText="ModuleID" SortExpression="ModuleID" />
        <asp:BoundField DataField="ID" HeaderText="ID" SortExpression="ID" />
    </Columns>
</asp:GridView>
<asp:ObjectDataSource ID="ObjectDataSourceCRS" runat="server" TypeName="HomeProd.Modules.Tmgr_CourseType.Tmgr_CourseTypeController" OldValuesParameterFormatString="original_{0}" SelectMethod="GetTmgr_CourseTypes">
</asp:ObjectDataSource>
<asp:ObjectDataSource ID="ObjectDataSource1" runat="server" OldValuesParameterFormatString="original_{0}"
    SelectMethod="GetTmgr_FltTraining" TypeName="HomeProd.Modules.Tmgr_CourseType.Tmgr_CourseTypeController">
    <SelectParameters>
        <asp:ControlParameter ControlID="txtFilter" Name="CourseID" PropertyName="Text" Type="String" DefaultValue="" />
    </SelectParameters>
</asp:ObjectDataSource>

</ascx end>

Regards..
Peter
 
New Post
4/21/2006 7:36 AM
 

why don't you do a two step filtering with 2 gridviews (pls. correct me if I didn't understand you correctly)?

1. You enter something into the text field
2. The filter gridview is filled with the data
3. You enter a value in the textbox and after that select an item in the gridview
4. You tie the click event of the button to the select method of the data source and in the selecting event of the GridView you create appropriate params for the select.
5. After the select is done you get another gridview right below the first one with filtered data.

I think that this kind of presentation is more user friendly and takes less time to program and should be generaly faster:
a) user friendly because no-one likes "blinking" screens (e.g. when you would select a row in your grid the data should disapeer, and completly new grid should become visible, you don't have an overview what you have clicked, how to get back, change selection.... nothing)
b) takes less time to program because asp.net team has been working real hard to make scenarios like this easy to implement.

if you still want to do it your way, you can try combining diffrent events of the GridView and ObjectDataSource (e.g. GridView - databinding, databound, ObjectDataSource - Selecting and such).

 


Thanks,
Vladan Strigo
NETMedia

My website: Vladan.Strigo.NET

Vladan.Strigo.NET: Projects
* Advanced VS2005 development approach - BlankModule
* DNN & Microsoft Ajax best practices guidance

Vladan.Strigo.NET: Resources
* Comprehensive list of DNN 4 Module development resources

 
New Post
4/21/2006 9:47 AM
 
Vladan,
        Thanks I never thought of using a second gridview and is worth looking into..

I still have one issue though the filtering that i am trying to implement is not working correctly (exceuting the Stored Procedure in my SQL Database works correctly), when i supply a value and i know that there is more than one value in the database the filter is only returning the first value of the filtered list not all the values. Not too sure why, any ideas??

Also I did end up fixing the paging by implementing a manual paging routine but that is by the way as i'll be looking into using your idea of a second gridview. The only problem that i need to fix now is the filter return values.

Regards..
Peter.
 
Previous
 
Next
HomeHomeArchived Discus...Archived Discus...Developing Under Previous Versions of .NETDeveloping Under Previous Versions of .NETASP.Net 2.0ASP.Net 2.0 Setting ObjectDataSource Select Method Programatically Setting ObjectDataSource Select Method Programatically


These Forums are dedicated to discussion of DNN Platform and Evoq Solutions.

For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:

  1. No Advertising. This includes promotion of commercial and non-commercial products or services which are not directly related to DNN.
  2. No vendor trolling / poaching. If someone posts about a vendor issue, allow the vendor or other customers to respond. Any post that looks like trolling / poaching will be removed.
  3. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
  4. No Flaming or Trolling.
  5. No Profanity, Racism, or Prejudice.
  6. Site Moderators have the final word on approving / removing a thread or post or comment.
  7. English language posting only, please.
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out