Sponsored Links

Archive for April, 2009

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.

Thanks for the responses

So sorry it’s been a while. Work has dealt me an overtime card that could last a couple of months, so I’ve been taking advantage of it. I think it’s a good thing, because it’s given me an opportunity to assess my goals with Android.  I’m a little discouraged by the (worthless) celebrity fanfare it’s received. It’s become…shallow. Mind you there are a few celebs out there who get it (BrentSpiner, donttrythis, PennGillette) but, the others have just ruined it for everyone else. I may continue efforts on TwitWit, for notoriety on the Twitter site, But plan to focus on areas that are scarce with development on the Android OS. Apparently, I’ve been secretive on my bio page. so I’ve updated it.

Uploading to TwitXR

Found these links helpful for creating an upload class capable of supporting TwitXR .
Upload multipart form using httpclient
Converting file to ByteArray

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.

April 2009
M T W T F S S
« Mar    
 12345
6789101112
13141516171819
20212223242526
27282930