OK...I am trying something a little different (for me) inspired by Kelley's article on feeds and Patrick's recent demo.
I have a simple form with a dropdown for countries and a dropdown for states. I populate the coutnries with a CDS as normal. I am calling a feed via jQuery to get the states(regions) back and it works perfectly....you change the country and get a new list of regions without a postback.
The problem is the data going into the database from the dropdown list for countries is the value code (221 for US eg) and not the text.
The regions dropdown is not passing anything back at all....empty.
I am simply trying to get the text value from the two controls to the db. I have no idea how this is going to work on an edit form yet or what issues I am going to face with that.
Here are my 2 dropdowns as defined:
<DropdownList
CssClass="xmpDDL"
id="ddlRegions"
DataField="EvtState"
DataType="string"
DataTextField="Text"
DataValueField="Text" >
</DropDownList>
.......
<DropdownList
CssClass="xmpDDL"
id="ddlCountries"
DataField="EvtCountry"
DataType="string"
DataTextField="Text"
DataValueField="Text"
DataSourceId="dsCountries"
AppendDataBoundItems="True" >
<ListItem Value="221" selected="true">
United States
</ListItem>
</DropDownList>
The CDS for the countries:
<ControlDataSource id="dsCountries" CommandText="SELECT EntryID, Text FROM Lists WHERE ListName='Country' ORDER BY Text"/>
and my jQuery stuff:
<jQueryReady>
$('#' + Event.ddlCountries).change
(
function()
{
var parentID = $(this).val();
$.ajax(
{
url: '/DesktopModules/XModPro/Feed.aspx',
type: 'POST',
dataType: 'html',
data:
{
"xfd" : "GetRegions",
"pid" : 0,
"parent" : parentID
},
success : function(data)
{
$('#' + Event.ddlRegions).html(data);
}
});
}
);
</jQueryReady>
<jQueryReady>
$('#'+Event.ddlCountries).trigger('change');
</jQueryReady>