Simple binding and Post back problem

This forum is only for questions or discussions about working with the mojoPortal source code in Visual Studio, obtaining the source code from the repository, developing custom features, etc. If your question is not along these lines this is not the right forum. Please try to post your question in the appropriate forum.

Please do not post questions about design, CSS, or skinning here. Use the Help With Skins Forum for those questions.

This forum is for discussing mojoPortal development

This forum is only for questions or discussions about working with the mojoPortal source code in Visual Studio, obtaining the source code from the repository, developing custom features, etc. If your question is not along these lines this is not the right forum. Please try to post your question in the appropriate forum.

You can monitor commits to the repository from this page. We also recommend developers to subscribe to email notifications in the developer forum as occasionally important things are announced.

Before posting questions here you might want to review the developer documentation.

Do not post questions about design, CSS, or skinning here. Use the Help With Skins Forum for those questions.
This thread is closed to new posts. You must sign in to post in the forums.
7/18/2009 9:41:52 AM
Gravatar
Total Posts 104

Simple binding and Post back problem

Hi,

I try to add a new custome Module , I use SampleExternalModule as a tamplae.

in my module , I have a DropDownList that must bind to one Table on db and after selecting one Item and click Next , I show some other data...

But in first step , I can bind Data, but in Post back Dropdown is Clear and therefore , I can't find the selected Item.

What is wrong?

Thanks

Code Behind

protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
// PopulateControls();
BindData();
}

}

protected void Button1_Click(object sender, EventArgs e)
{
Label1.Text = DropDownList1.SelectedItem.Text;
}
private void BindData()
{
Label1.Text = "bind";
this.DropDownList1.DataSource = TblIndGroup.FetchAll();
this.DropDownList1.DataTextField = TblIndGroup.Columns.Title;
this.DropDownList1.DataValueField = TblIndGroup.Columns.IndGroupCode;

this.DropDownList1.DataBind();
}

 

=====================

<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="test1.ascx.cs" Inherits="mojoPortal.Web.Modules.test1" %>
<%@ Register TagPrefix="portal" Namespace="mojoPortal.Web" Assembly="mojoPortal.Web" %>
<%@ Register TagPrefix="portal" Namespace="mojoPortal.Web.UI" Assembly="mojoPortal.Web" %>
<%@ Register TagPrefix="mp" Namespace="mojoPortal.Web.Controls" Assembly="mojoPortal.Web.Controls" %>

<portal:ModuleTitleControl id="moduleTitle" runat="server" />
<asp:Panel ID="pnlSample" Runat="server">

<asp:DropDownList ID="DropDownList1" runat="server"
EnableViewState=true>
</asp:DropDownList>
<asp:Button ID="Button1" runat="server" Text="Button" onclick="Button1_Click" />
<br />
<asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>
</asp:Panel>
<div class="modulefooter">&nbsp;</div>
 

 

UPDATE  I find the solution here

You must sign in to post in the forums. This thread is closed to new posts.