Answered by:
Problem creating web control

Question
-
User-1076705603 posted
ok here's what i'm trying to do
here's my control that i'm trying to make, i want the filters to work along the lines of how the SelectParameters do in the SqlDataSource. the problem is the designer keeps telling me that the cssi:AdHocQueryFilter is an unknown server tag.1 <cssi:AdHocQueryBuilder ID="AdHocQueryBuilder1" runat="server"> 2 <Filters> 3 <cssi:AdHocQueryFilter DataType="dateTime" FieldName="dd" DisplayName="dfs" /> 4 </Filters> 5 </cssi:AdHocQueryBuilder> 6 7 <asp:SqlDataSource ID="SqlDataSource1" runat="server"> 8 <SelectParameters> 9 <asp:Parameter Name="xxx" DefaultValue="ddd" /> 10 </SelectParameters> 11 </asp:SqlDataSource>
here's the code for the AdHocQueryFilter class
1 Imports System.Web.UI 2 Imports System.Collections 3 Namespace UI.WebControls.AdHocQuery 4 5 <ToolboxData("<{0}:AdHocQueryFilter />")> _ 6 Public Class AdHocQueryFilter 7 Implements IStateManager 8 9 Private m_IsTrackingViewState As Boolean 10 Private m_ViewState As StateBag 11 12 <PersistenceMode(PersistenceMode.Attribute)> _ 13 <System.ComponentModel.NotifyParentProperty(True)> _ 14 Public Property DisplayName() As String 15 Get 16 Dim value As Object = ViewState("DisplayName") 17 Return IIf(value IsNot Nothing, value, String.Empty) 18 End Get 19 Set(ByVal value As String) 20 ViewState("DisplayName") = value 21 End Set 22 End Property 23 24 <PersistenceMode(PersistenceMode.Attribute)> _ 25 <System.ComponentModel.NotifyParentProperty(True)> _ 26 Public Property FieldName() As String 27 Get 28 Dim value As Object = ViewState("FieldName") 29 Return IIf(value IsNot Nothing, value, String.Empty) 30 End Get 31 Set(ByVal value As String) 32 ViewState("FieldName") = value 33 End Set 34 End Property 35 36 <PersistenceMode(PersistenceMode.Attribute)> _ 37 <System.ComponentModel.NotifyParentProperty(True)> _ 38 Public Property DataType() As System.TypeCode 39 Get 40 Dim value As Object = ViewState("DataType") 41 Return IIf(value IsNot Nothing, value, TypeCode.Empty) 42 End Get 43 Set(ByVal value As System.TypeCode) 44 ViewState("DataType") = value 45 End Set 46 End Property 47 48 Public Sub SetDirty() 49 Me.ViewState.SetDirty(True) 50 End Sub 51 52 Protected Overridable ReadOnly Property ViewState() As StateBag 53 Get 54 If m_ViewState Is Nothing Then 55 m_ViewState = New StateBag(False) 56 If m_IsTrackingViewState Then 57 DirectCast(m_ViewState, IStateManager).TrackViewState() 58 End If 59 End If 60 Return m_ViewState 61 End Get 62 End Property 63 64 <System.ComponentModel.Browsable(False)> _ 65 Public ReadOnly Property IsTrackingViewState() As Boolean Implements System.Web.UI.IStateManager.IsTrackingViewState 66 Get 67 Return m_IsTrackingViewState 68 End Get 69 End Property 70 71 Public Sub LoadViewState(ByVal state As Object) Implements System.Web.UI.IStateManager.LoadViewState 72 If state IsNot Nothing Then 73 DirectCast(ViewState, IStateManager).LoadViewState(state) 74 End If 75 End Sub 76 77 Public Function SaveViewState() As Object Implements System.Web.UI.IStateManager.SaveViewState 78 Dim retval As Object = Nothing 79 If m_ViewState IsNot Nothing Then 80 retval = DirectCast(m_ViewState, IStateManager).SaveViewState 81 End If 82 Return retval 83 End Function 84 85 Public Sub TrackViewState() Implements System.Web.UI.IStateManager.TrackViewState 86 m_IsTrackingViewState = True 87 If m_ViewState IsNot Nothing Then 88 DirectCast(m_ViewState, IStateManager).TrackViewState() 89 End If 90 End Sub 91 92 End Class 93 94 End Namespace
Sunday, August 17, 2008 10:21 AM
Answers
-
User-16411453 posted
Strange looking control code.
Filters would be a control collection, but I don't see any collections in the code.
Here's a link that describes how to make them or just google (asp.net, collection properties)
http://www.west-wind.com/WebLog/posts/7060.aspx
<cssi:AdHocQueryBuilder ID="AdHocQueryBuilder1" runat="server">
2 <Filters>
3 <cssi:AdHocQueryFilter DataType="dateTime" FieldName="dd" DisplayName="dfs" />
4 </Filters>
5 </cssi:AdHocQueryBuilder>- Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
Thursday, August 21, 2008 5:54 PM
All replies
-
User-1076705603 posted
ok so i have it almost working, but now this is what shows up in the designer when i set anything whether it be a style the or the filters, bascially anything that's has an attribute of innerproperty.
Wednesday, August 20, 2008 9:31 AM -
User-16411453 posted
Strange looking control code.
Filters would be a control collection, but I don't see any collections in the code.
Here's a link that describes how to make them or just google (asp.net, collection properties)
http://www.west-wind.com/WebLog/posts/7060.aspx
<cssi:AdHocQueryBuilder ID="AdHocQueryBuilder1" runat="server">
2 <Filters>
3 <cssi:AdHocQueryFilter DataType="dateTime" FieldName="dd" DisplayName="dfs" />
4 </Filters>
5 </cssi:AdHocQueryBuilder>- Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
Thursday, August 21, 2008 5:54 PM -
User-16411453 posted
Don't forget to mark your other post as answered.
Friday, August 22, 2008 5:39 PM