Ciao a tutti.
In VS 2010 ho creato la pagina che posto di seguito... i dati inseriti nei vari steps del form popolano correttamente la asp Label... ma se volessi memorizzarli in un database che metodo devo usare? La asp:SqlDataSource non riesco a farla funzionare, non dà errori ma il db non si popola... grazie.
<%@ Page Language="C#" %>
<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Data.Odbc" %>
<%@ Import Namespace="System.Configuration" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<script runat="server">
public void Page_Load (Object sender, EventArgs e)
{
OdbcConnection myConnectionString = new OdbcConnection(ConfigurationManager.ConnectionStrings["ConnMySQL"].ConnectionString);
myConnectionString.Open();
myConnectionString.Close();
}
protected void WizardStep3_Activate(object sender, EventArgs e)
{
Label1.Text = nome.Text.ToString() + "<br>" +
cognome.Text.ToString() + "<br>" +
email.Text.ToString();
}
</script>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<asp:Wizard ID="Wizard1" runat="server" ActiveStepIndex="0"
StartNextButtonImageUrl = "/_aspx/styles/yellow/next-48.png"
StartNextButtonType="Image"
StepNextButtonType="Image"
StepNextButtonImageUrl="/_aspx/styles/yellow/next-48.png"
StepPreviousButtonType="Image"
StepPreviousButtonImageUrl="/_aspx/styles/yellow/prev-48.png"
FinishPreviousButtonImageUrl="/_aspx/styles/yellow/prev-48.png"
FinishPreviousButtonType="Image"
FinishCompleteButtonImageUrl="/_aspx/styles/yellow/subscribe.png"
FinishCompleteButtonType="Image"
CancelButtonType="Image"
CancelButtonImageUrl="/_aspx/styles/yellow/prev-48.png"
DisplaySideBar="false">
<WizardSteps>
<asp:WizardStep ID="WizardStep1" runat="server" Title="Passaggio 1">Nome
<asp:TextBox ID="nome" runat="server"></asp:TextBox>
<br /><br />Cognome
<asp:TextBox ID="cognome" runat="server"></asp:TextBox>
</asp:WizardStep>
<asp:WizardStep ID="WizardStep2" runat="server" Title="Passaggio 2">Email
<asp:TextBox ID="email" runat="server"></asp:TextBox>
</asp:WizardStep>
<asp:WizardStep ID="WizardStep4" runat="server" Title="Fine" StepType="Complete" OnActivate="WizardStep3_Activate">
Grazie!<br /><br />
<asp:Label ID="Label1" runat="server">
</asp:Label>
</asp:WizardStep>
</WizardSteps>
</asp:Wizard>
</form>
</body>
</html>
Modificato da orcim il 27 marzo 2011 00.30 -