Products

Solutions

Resources

Partners

Community

Blog

About

QA

Ideas Test

New Community Website

Ordinarily, you'd be at the right spot, but we've recently launched a brand new community website... For the community, by the community.

Yay... Take Me to the Community!

Welcome to the DNN Community Forums, your preferred source of online community support for all things related to DNN.
In order to participate you must be a registered DNNizen

HomeHomeArchived Discus...Archived Discus...Developing Under Previous Versions of .NETDeveloping Under Previous Versions of .NETASP.Net 2.0ASP.Net 2.0ModuleId returns 0ModuleId returns 0
Previous
 
Next
New Post
8/31/2007 4:44 PM
 

I think if you scratch your SetModuleID routine and in your page load, just set lblModuleID.Text = ctype(ModuleID, String) you should be fine.

Because you're using a RadGrid, though, you don't even really need the controller.  The RadGrid will do the update automatically.  Either way, (automaticupdates=true/false) will work, though.

 
New Post
8/31/2007 5:00 PM
 

I have tried to remove my SetModuleID routine and used as you suggested lblModuleID.Text = ctype(ModuleID, String) in the page_load event, but still the ModuleId in the table is 0 (the default value). I have also posted this problem in the Telerik forums, but I get no replies.

 
New Post
8/31/2007 5:24 PM
 

do you mind posting the RadGrid portion of your ascx?

 

 
New Post
8/31/2007 5:34 PM
 

Of course not. Here's the RadGrid and ObjectDataSource:

<radG:RadGrid ID="RadGrid1"
    runat="server"
    AutoGenerateColumns="false"
    ShowHeader="false"
    Skin="Outlook"
    AllowAutomaticDeletes="true"
    AllowAutomaticInserts="true"
    AllowAutomaticUpdates="true"
    DataSourceID="ObjectDataSource_QBirthdayToday"
    CommandItemStyle-CssClass="normal">
    <MasterTableView
        DataKeyNames="ID,ModuleId"
        GridLines="None"
        DataSourcePersistenceMode="ViewState">
        <Columns>
            <radG:GridEditCommandColumn UniqueName="btnEdit" ItemStyle-CssClass="normal" />
            <radG:GridBoundColumn DataField="ID" UniqueName="ID" HeaderText="ID" HeaderStyle-CssClass="normal" Visible="false" ItemStyle-CssClass="normal" Display="false" />
            <radG:GridBoundColumn DataField="ModuleId" UniqueName="ModuleId" HeaderText="ModuleId" HeaderStyle-CssClass="normal" ItemStyle-CssClass="normal" />
            <radG:GridBoundColumn DataField="IndividualFirstName" UniqueName="IndividualFirstName" HeaderText="Fornavn" HeaderStyle-CssClass="normal" ItemStyle-CssClass="normal" Visible="false" />
            <radG:GridBoundColumn DataField="IndividualLastName" UniqueName="IndividualLastName" HeaderText="Etternavn" HeaderStyle-CssClass="normal" ItemStyle-CssClass="normal" Visible="false" />
            <radG:GridBoundColumn DataField="Individual" UniqueName="Individual" HeaderText="Visningsnavn" HeaderStyle-CssClass="normal" ItemStyle-CssClass="normal" />
            <radG:GridBoundColumn DataField="Day" UniqueName="Day" HeaderText="Dag" HeaderStyle-CssClass="normal" ItemStyle-CssClass="normal" Visible="false" />
            <radG:GridBoundColumn DataField="Month" UniqueName="Month" HeaderText="Måned" HeaderStyle-CssClass="normal" ItemStyle-CssClass="normal" Visible="false" />
            <radG:GridBoundColumn DataField="Year" UniqueName="Year" HeaderText="År" HeaderStyle-CssClass="normal" ItemStyle-CssClass="normal" Visible="false" />
            <radG:GridBoundColumn DataField="Age" UniqueName="Age" HeaderText="Alder" HeaderStyle-CssClass="normal" ItemStyle-CssClass="normal" />
            <radG:GridBoundColumn DataField="IsLiving" UniqueName="IsLiving" HeaderStyle-CssClass="normal" HeaderText="IsLiving" ItemStyle-CssClass="normal" Visible="false" />
            <radG:GridButtonColumn ButtonType="LinkButton" UniqueName="btnDelete" ItemStyle-CssClass="normal" Text="Delete" CommandName="Delete" ConfirmText="Er du sikker på at du vil slette?" />
        </Columns>
        <EditFormSettings EditFormType="Template">
            <FormTemplate>
            <editcolumn uniquename="EditCommandColumn1"></editcolumn>
                <table border="0" cellpadding="2" cellspacing="0">
                    <tr>
                        <td class="normal" align="right"><asp:Label ID="lblFirstName" runat="server" Text="First Name" resourcekey="lblFirstNameResource1"></asp:Label></td>
                        <td class="normal"><asp:TextBox ID="txtFirstName" runat="server" Width="200px" Text='<%# Bind("IndividualFirstName") %>' meta:resourcekey="txtFirstNameResource1"></asp:TextBox>
                        <asp:RequiredFieldValidator ID="rfvFirstName" runat="server" ErrorMessage="RequiredFieldValidator" Text=" *" ControlToValidate="txtFirstName" meta:resourcekey="rfvFirstNameResource1"></asp:RequiredFieldValidator></td>
                    </tr>
                    <tr>
                        <td class="normal" align="right"><asp:Label ID="lblLastName" runat="server" Text="Last Name" resourcekey="lblLastNameResource1"></asp:Label></td>
                        <td class="normal"><asp:TextBox ID="txtLastName" runat="server" Width="200px" Text='<%# Bind("IndividualLastName") %>' meta:resourcekey="txtLastNameResource1"></asp:TextBox>
                        <asp:RequiredFieldValidator ID="rfvLastName" runat="server" ErrorMessage="RequiredFieldValidator" Text=" *" ControlToValidate="txtLastName" meta:resourcekey="rfvLastNameResource1"></asp:RequiredFieldValidator></td>
                    </tr>
                    <tr>
                        <td class="normal" align="right"><asp:Label ID="lblDisplayName" runat="server" Text="Display Name" resourcekey="lblDisplayNameResource1"></asp:Label></td>
                        <td class="normal"><asp:TextBox ID="txtDisplayName" runat="server" Width="200px" Text='<%# Bind("Individual") %>' meta:resourcekey="txtDisplayNameResource1"></asp:TextBox>
                        <asp:RequiredFieldValidator ID="rfvDisplayName" runat="server" ErrorMessage="RequiredFieldValidator" Text=" *" ControlToValidate="txtDisplayName" meta:resourcekey="rfvDisplayNameResource1"></asp:RequiredFieldValidator></td>
                    </tr>
                    <tr>
                        <td class="normal" align="right"><asp:Label ID="lblDay" runat="server" Text="Day" resourcekey="lblDayResource1"></asp:Label></td>
                        <td class="normal"><asp:TextBox ID="txtDay" runat="server" Width="30px" Text='<%# Bind("Day") %>' meta:resourcekey="txtDayResource1"></asp:TextBox>
                        <asp:RequiredFieldValidator ID="rfvDay" runat="server" ErrorMessage="RequiredFieldValidator" Text=" *" ControlToValidate="txtDay" meta:resourcekey="rfvDayResource1"></asp:RequiredFieldValidator></td>
                    </tr>
                    <tr>
                        <td class="normal" align="right"><asp:Label ID="lblMonth" runat="server" Text="Month" resourcekey="lblMonthResource1"></asp:Label></td>
                        <td class="normal"><asp:TextBox ID="txtMonth" runat="server" Width="30px" Text='<%# Bind("Month") %>' meta:resourcekey="txtMonthResource1"></asp:TextBox>
                        <asp:RequiredFieldValidator ID="rfvMonth" runat="server" ErrorMessage="RequiredFieldValidator" Text=" *" ControlToValidate="txtMonth" meta:resourcekey="rfvMonthResource1"></asp:RequiredFieldValidator></td>
                    </tr>
                    <tr>
                        <td class="normal" align="right"><asp:Label ID="lblYear" runat="server" Text="Year" resourcekey="lblYearResource1"></asp:Label></td>
                        <td class="normal"><asp:TextBox ID="txtYear" runat="server" Width="60px" Text='<%# Bind("Year") %>' meta:resourcekey="txtYearResource1"></asp:TextBox>
                        <asp:RequiredFieldValidator ID="rfvYear" runat="server" ErrorMessage="RequiredFieldValidator" Text=" *" ControlToValidate="txtYear" meta:resourcekey="rfvYearResource1"></asp:RequiredFieldValidator></td>
                    </tr>
                    <tr>
                        <td class="normal" align="right"><asp:Label ID="lblIsLiving" runat="server" Text="Lever" resourcekey="lblIsLivingResource1"></asp:Label></td>
                        <td class="normal"><asp:TextBox ID="txtIsLiving" runat="server" Width="30px" Text='<%# Bind("IsLiving") %>' resourcekey="txtIsLivingResource1"></asp:TextBox></td>
                    </tr>
                    <tr>
                        <td class="normal"></td>
                        <td class="normal" align="center"><asp:Button ID="btnUpdate" Text='<%# IIf( DataBinder.Eval(Container, "OwnerTableView.IsItemInserted"), "Add New", "Update")%>' runat="server" CommandName='<%# IIf( DataBinder.Eval(Container, "OwnerTableView.IsItemInserted"), "PerformInsert", "Update") %>'></asp:Button>&nbsp;
                                                          <asp:Button ID="btnCancel" Text="Cancel" runat="server" CommandName="Cancel" CausesValidation="False"></asp:Button></td>
                    </tr>
                </table>
            </FormTemplate>
        </EditFormSettings>
    </MasterTableView>
</radG:RadGrid>
<asp:Label ID="lblModuleId" runat="server"></asp:Label>

<asp:ObjectDataSource ID="ObjectDataSource_QBirthdayToday"
    runat="server"
    DataObjectTypeName="Q.Modules.BirthdayToday.QBirthdayTodayInfo"
    SelectMethod="QBirthdayToday_Select"
    InsertMethod="QBirthdayToday_Insert"
    UpdateMethod="QBirthdayToday_Update"
    DeleteMethod="QBirthdayTodayInfo_Delete"
    OldValuesParameterFormatString="original_{0}"
    OnInit="Page_Load"
    TypeName="Q.Modules.BirthdayToday.QBirthdayTodayController">
    <InsertParameters>
        <asp:ControlParameter ControlID="lblModuleId" Name="ModuleId" PropertyName="Text" Type="Int32" />
    </InsertParameters>
</asp:ObjectDataSource>

 
New Post
9/1/2007 12:42 PM
 

OK, I think I see what's happening.  In your grid you have this column:

<radG:GridBoundColumn DataField="ModuleId" UniqueName="ModuleId" HeaderText="ModuleId" HeaderStyle-CssClass="normal" ItemStyle-CssClass="normal" />

Then in your InsertParameters, you are assigning the same name:

<asp:ControlParameter ControlID="lblModuleId" Name="ModuleId" PropertyName="Text" Type="Int32" />

Because you are using AllowAutomaticInserts="True", the RadGrid will ignore your ControlParameter, because you have GridBoundColumn with the same name.  The GridBoundColumn value is what is getting sent to your stored proc.  Since you aren't setting that anywhere, the default value is used.  You should be able to just set the ReadOnly property to True on your GridBoundColumn, and it will get ignored when passing to your stored proc.

<radG:GridBoundColumn ReadOnly="True" DataField="ModuleId" UniqueName="ModuleId" HeaderText="ModuleId" HeaderStyle-CssClass="normal" ItemStyle-CssClass="normal" />

This way, you don't have a column named ModuleID automatically sending a value.  In your stored proc, you should have declared @ModuleID int.  Since your stored proc needs a moduleid and the RadGrid isn't automatically sending one, it will look to your InsertParameters for the value.

LMK how you make out.

 

 
Previous
 
Next
HomeHomeArchived Discus...Archived Discus...Developing Under Previous Versions of .NETDeveloping Under Previous Versions of .NETASP.Net 2.0ASP.Net 2.0ModuleId returns 0ModuleId returns 0


These Forums are dedicated to discussion of DNN Platform and Evoq Solutions.

For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:

  1. No Advertising. This includes promotion of commercial and non-commercial products or services which are not directly related to DNN.
  2. No vendor trolling / poaching. If someone posts about a vendor issue, allow the vendor or other customers to respond. Any post that looks like trolling / poaching will be removed.
  3. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
  4. No Flaming or Trolling.
  5. No Profanity, Racism, or Prejudice.
  6. Site Moderators have the final word on approving / removing a thread or post or comment.
  7. English language posting only, please.
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out