Archive for the ‘Uncategorized’ Category

ASP.NET 3.5 ListView and Databinding a DropdownList inside InsertTemplate

What I was finding for binding a dropdown list in an insertemplate for a 3.5 Listview has been either erroneous or clunky. First the issue:

When triggering an Insert Template to appear, there is no event that occurs as the form is rendered, like the the Update form. So any dropdown list, pretty much needs to be filled before fact. Or not…..

I created a simple web control inherited from the dropdown, and have it load from a datasource on it’s load. With a couple of checks, it loads once, and doesn’t repeat the databind. While the code I  put here probably won’t work exactly as is outside of my app’s context (custom object collections are retrieved a bound) You’ll get the idea. Once you create the control, simply put it in the template. No additional work needed!


Imports System
Imports System.Collections.Generic
ImportsSystem.ComponentModel
Imports System.Text
Imports System.Web
Imports System.Web.UI
ImportsSystem.Web.UI.WebControls  <DefaultProperty("Text"), ToolboxData("<{0}:ServerControl1 runat=server></{0}:ServerControl1>")> _
Public ClassTypeDropDownList
InheritsDropDownList<Bindable(True), Category("Data"), DefaultValue(""), Localizable(True)> PropertyTypeName() As String
   Get
      Dim s As String = CStr(ViewState("TypeName"))
      If s Is Nothing Then
        Return "[" + Me.ID + "]"
      Else
        Return s
      End If
  End Get
  Set(ByVal Value As String)ViewState("TypeName") = Value
  End Set
End Property
<Bindable(True), Category("Data"), DefaultValue("False"), Localizable(True)> PropertyIsLoaded() As Boolean
Get
   IfViewState("IsLoaded") IsNot Nothing Then
     Return CBool(ViewState("IsLoaded"))
   Else
     Return False
   End If
End Get
Set(ByVal Value As Boolean)ViewState("IsLoaded") = Value
End Set
End Property

Private Sub ServerControl1_Load(ByVal sender As Object, ByVal e AsSystem.EventArgs) Handles Me.Load
	DimopRes AsdbhJRBusiness.OperationResult
	If Not Me.IsLoaded Then
		DimlItems As List(OfdbhJRBusiness.DataContracts.TypeContract)
		Dimotyp As NewdbhJRBusiness.Entities.TypeEntity(Me.TypeName) opRes = otyp.GetListItems
 		If opRes.Success = True ThenlItems =CType(opRes.data, List(OfdbhJRBusiness.DataContracts.TypeContract))
			Me.DataSource = lItems
			Me.DataBind()
			Me.IsLoaded = True

		End If
	otyp =Nothing


	End If
End Sub
End  Class
And here is what I've put in the aspx. Note the simple way to find to the value.  

 

<isd:TypeDropDownList runat="server" DataTextField="LongDesc"  

SelectedValue='<%# DataBinder.Eval(Container.DataItem, "AddressTypeGUID") %>' 

DataValueField="Id" ID="ddlAddresstype" TypeName="AddressType" /> 

 Hope this helps! I'll respond to any questions, but please be patient!

Android 1.5 is here!

So I see that Google has published the new OS. I’ve downloaded it, and plan to assess the new features and maybe how I can put a few apps out fast. TwitWit has graced me with the skillset needed to do some cool stuff.

Decision on Pictures

I think I”ll go with TwitXR over TwitPic for their api. I’m no security expert, it seems to me that TwitXR api is more secure than others. TwitXR seems to at least cover themselves with some basic authentication, which I’m accustomed to. Also, I think this first version will not cache the images to the sd card. Maybe an option later.

Developers for WordPress?

It turns out that there doesn’t seem to be a lot of support from developers for WordPress. I found an issue with some plug-ins that was occurring when under iis7, and using php. Apparently, a post tag wasn’t being passed in the variable. simply hard-coding it into the plug-in’s form action page fixed it nicely. Well, maybe I’ll need to make a bigger presence as well. And all I wanted to do is setup a blog!

November 2018
M T W T F S S
« Feb    
 1234
567891011
12131415161718
19202122232425
2627282930