Any reason you are not doing this in code behind where you can just set the DataMember of the DataList after calling the function?