Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
UserControl & Form's fields
Message
 
 
To
All
General information
Forum:
ASP.NET
Category:
Other
Title:
UserControl & Form's fields
Environment versions
OS:
Windows XP
Database:
MS SQL Server
Miscellaneous
Thread ID:
01319528
Message ID:
01319528
Views:
59
Hi everybody,

I have a FormView which uses sort of a tab control. Each tab shows different kind of information: General, Contact Info, etc.

I thought it would be a good idea to move these tabs' fields into separate UserControls, so, for example, I now have:
<%@ Control Language="C#" AutoEventWireup="true" CodeFile="UserInfo.ascx.cs" Inherits="Coordinator_UCD_UserInfo" Description="UserName & Password Info" %>
<div class = "cl">
<label class="bx">
User Name </label><span class="bx"><asp:TextBox ID="UserName" 
    Text='<%# Bind("UserName") %>' MaxLength="25" runat="server" />
<asp:RequiredFieldValidator ID="RequiredFieldValidator12" runat="server" 
    ControlToValidate="UserName" ErrorMessage="User Name is Required"></asp:RequiredFieldValidator></span></div>
<br />
<br />
<br /> 
<div class="cl">
<label class="bx"> Password  </label><span class="bx"><asp:TextBox ID="Pwd" Text='<%# Bind("Pwd") %>' runat="server" AutoCompleteType="Disabled" /><asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" ControlToValidate="Pwd" Display="Static" ErrorMessage="Password Required"></asp:RequiredFieldValidator></span></div>
This one is the simplest UserControl with only 2 fields.

The page itself has the FormView defined. The question is - how does the UserControl know how to bind to the Insert Parameters?

In the ItemInserting method looping through form's values shows 0 as a count, so somehow my parameters are not getting set correctly.
foreach (DictionaryEntry entry in e.Values)
    {
      if (entry.Value.Equals(""))
      {
        // Use the Cancel property to cancel the 
        // insert operation.
        //e.Cancel = true;

     //   MessageLabel.Text += "Please enter a value for the " +
     //     entry.Key.ToString() + " field.<br/>";

      }
    }
What should I do to properly pass parameters to and from UserControl?

Thanks a million in advance.
If it's not broken, fix it until it is.


My Blog
Reply
Map
View

Click here to load this message in the networking platform