I am needing the user to be able to select their email address in the DropDownList menu, be presented with ListBox selections and when they move the selections to the second listbox window, their UserId and Email Address are saved into the database along with their ListBox selection. I am having difficulty with the datakeyfield, datatextfield, DataValueField setup in the controls. I setup the two labels to ensure I get the proper return from the DropDown menu prior to moving the ListBox selection. I have tried all available values but seem to get the UserId in both the Email and ID columns or vice-versa. Please help.
_ JT
Hi Dimitar,
Sorry for the lack of clairity. The issue is definately with the RadListBox. The 2 labels will show the correct selected values for Email & UserID (as ID), when a selection is made in the drop-down menu. The problem is that I need to have those 2 values submitted to the database, along with the selected Name value, when the Name selection goes from RadListBox1 to RadListBox2 by the user.
Thanks,
_ JT
_ JT
Hi Dimitar,
Sorry for the lack of clairity. The issue is definately with the RadListBox. The 2 labels will show the correct selected values for Email & UserID (as ID), when a selection is made in the drop-down menu. The problem is that I need to have those 2 values submitted to the database, along with the selected Name value, when the Name selection goes from RadListBox1 to RadListBox2 by the user.
Thanks,
_ JT
<telerik:radajaxloadingpanel runat=
"server"
id=
"RadAjaxLoadingPanel1"
skin=
"Office2007"
/>
<telerik:radajaxpanel runat=
"server"
id=
"RadAjaxPanel1"
loadingpanelid=
"RadAjaxLoadingPanel1"
>
<!-- ---------------------------------------------------------------------- -->
<!-- DropDownList control start ----------------------------------------------- -->
<!-- ---------------------------------------------------------------------- -->
<asp:sqldatasource id=
"SqlDataSource2"
connectionstring=
"<%$ ConnectionStrings:IPdataConnectionString %>"
providername=
"System.Data.SqlClient"
selectcommand=
"SELECT DISTINCT Email, UserId as ID FROM [aspnet_Membership]"
runat=
"server"
></asp:sqldatasource>
<label
for
=
"EmailDDN"
>
<asp:label id=
"Label2"
runat=
"server"
class
=
"text"
>Select Email: </asp:label>
</label>
<asp:dropdownlist id=
"EmailDDN"
runat=
"server"
autopostback=
"True"
datasourceid=
"SqlDataSource2"
appenddatabounditems=
"True"
datakeyfield=
"ID"
datatextfield=
"Email"
datavaluefield=
"Email"
onselectedindexchanged=
"DDN_SelectedIndexChanged"
>
<asp:listitem>
Select your email address
</asp:listitem>
</asp:dropdownlist>
<br />
<asp:label id=
"EmailLabel1"
runat=
"server"
>Selected Email: </asp:label>
<br />
<asp:label id=
"EmailLabel2"
runat=
"server"
>Selected Value: </asp:label>
<br />
<!-- ------------------------------------------------------------------ -->
<!-- ---------------------------------------------------------------------- -->
<!-- ListBox control start -------------------------------------------- -->
<telerik:radlistbox runat=
"server"
id=
"RadListBox1"
skin=
"Office2007"
datasourceid=
"SourceDataSource"
allowautomaticupdates=
"true"
datakeyfield=
"ID"
datatextfield=
"Name"
DataValueField=
"ID"
height=
"200px"
allowtransfer=
"true"
transfertoid=
"RadListBox2"
transfermode=
"Copy"
width=
"230px"
autopostbackontransfer=
"true"
/>
<telerik:radlistbox runat=
"server"
id=
"RadListBox2"
datasourceid=
"DestinationDataSource"
allowautomaticupdates=
"true"
datakeyfield=
"ID"
datatextfield=
"Name"
DataValueField=
"ID"
height=
"200px"
allowreorder=
"true"
autopostbackonreorder=
"true"
allowdelete=
"True"
width=
"230px"
autopostbackondelete=
"true"
/>
<asp:sqldatasource id=
"SourceDataSource"
runat=
"server"
connectionstring=
"<%$ ConnectionStrings:IPdataConnectionString %>"
providername=
"System.Data.SqlClient"
deletecommand=
"DELETE FROM Products WHERE ID = @ID"
insertcommand=
"INSERT INTO Products (Name, ID, Email) VALUES (@Name, @ID, @Email)"
selectcommand=
"SELECT Name, ID FROM Products"
updatecommand=
"UPDATE Products SET Name = @Name, Email = @Email WHERE ID = @ID"
>
<deleteparameters>
<asp:parameter name=
"ID"
type=
"Int32"
/>
</deleteparameters>
<insertparameters>
<asp:parameter name=
"Name"
type=
"String"
/>
<asp:controlparameter name=
"Email"
propertyname=
"SelectedValue"
controlid=
"EmailDDN"
type=
"String"
/>
<asp:controlparameter name=
"ID"
propertyname=
"SelectedValue"
controlid=
"EmailDDN"
type=
"String"
/>
</insertparameters>
<selectparameters>
<asp:controlparameter name=
"Email"
controlid=
"EmailDDN"
propertyname=
"SelectedValue"
type=
"String"
/>
<asp:controlparameter name=
"ID"
propertyname=
"SelectedValue"
controlid=
"EmailDDN"
type=
"String"
/>
</selectparameters>
<updateparameters>
<asp:parameter name=
"Name"
type=
"String"
/>
<asp:controlparameter name=
"Email"
propertyname=
"SelectedValue"
controlid=
"EmailDDN"
type=
"String"
/>
<asp:controlparameter name=
"ID"
propertyname=
"SelectedValue"
controlid=
"EmailDDN"
type=
"String"
/>
</updateparameters>
</asp:sqldatasource>
<asp:sqldatasource id=
"DestinationDataSource"
runat=
"server"
connectionstring=
"<%$ ConnectionStrings:IPdataConnectionString %>"
providername=
"System.Data.SqlClient"
deletecommand=
"DELETE FROM ProductsMail WHERE ID = @ID"
insertcommand=
"INSERT INTO ProductsMail (Name, Email, ID) VALUES (@Name, @Email, @ID)"
selectcommand=
"SELECT Name, ID, Email FROM ProductsMail"
updatecommand=
"UPDATE ProductsMail SET Name = @Name, Email = @Email WHERE ID = @ID"
>
<deleteparameters>
<asp:parameter name=
"ID"
type=
"Int32"
/>
</deleteparameters>
<insertparameters>
<asp:parameter name=
"Name"
type=
"String"
/>
<asp:controlparameter name=
"Email"
propertyname=
"SelectedValue"
controlid=
"EmailDDN"
type=
"String"
/>
<asp:controlparameter name=
"ID"
propertyname=
"SelectedValue"
controlid=
"EmailDDN"
type=
"String"
/>
</insertparameters>
<updateparameters>
<asp:parameter name=
"Name"
type=
"String"
/>
<asp:controlparameter name=
"Email"
propertyname=
"SelectedValue"
controlid=
"EmailDDN"
type=
"String"
/>
<asp:controlparameter name=
"ID"
propertyname=
"SelectedValue"
controlid=
"EmailDDN"
type=
"String"
/>
</updateparameters>
</asp:sqldatasource>
</telerik:radajaxpanel>
====
protected void DDN_SelectedIndexChanged(System.Object sender, System.EventArgs e)
{
EmailLabel1.Text = EmailDDN.SelectedItem.ToString();
EmailLabel2.Text = EmailDDN.SelectedValue.ToString();
}