PDA

View Full Version : FormParameters not being passed


jim_denney
08-12-2010, 03:17 PM
I am using a ModalPopupExenter to handle inserting new records into a GridView in VS2008. I am calling a stored procedure in SQl Server 2008 to handle the inserts and updates.

When I try to save the data from the modal popup, the procedure is called but no values show up in the data table. If I set default values on the FormParameters, they are inserted, so the values are not being read from the modal popup. Any ideas what I am doing wrong?

[CODE]
Code calling the procedure:
InsertCommandType="StoredProcedure" InsertCommand="AddUpdateTrainingCourse">

<InsertParameters>
<asp:formparameter Name="pKey" FormField="tbxpKey" DefaultValue="-1" />
<asp:formparameter Name="fkSponsor" FormField="tbxSite" />
<asp:formparameter Name="EndDate" FormField="tbxEnding" />
<asp:formparameter Name="Hours" FormField="tbxHours" />
<asp:formparameter Name="StartDate" FormField="tbxStarting" />
<asp:formparameter Name="Title" FormField="tbxCourse" DefaultValue="It is not passing anything..."/>
<asp:formparameter Name="Trainers" FormField="tbxTeachers" />
</InsertParameters>

Code for the popup:
<div>
<asp:ModalPopupExtender
ID="mpeEditArea"
runat="server"
PopupControlID="divEditArea"
TargetControlID="ImgBtnNew"
Drag="True"
DropShadow="True"
PopupDragHandleControlID="pnlDragHandle"
BackgroundCssClass="modalBackground ">
</asp:ModalPopupExtender>
</div>

<div id="divEditArea" class="modalPanel" style="display:none">
<asp:Panel
runat="server"
ID="PanelDragHandle"
CssClass="modalPanelTitle">
Hold Here to drag the box...
</asp:Panel>
<p>
<asp:label runat="server" ID="lblmpe1" text="Course: "></asp:label>
<asp:TextBox
ID="tbxCourse"
runat="server"
CssClass="editrow" text=" "
Width="300"></asp:TextBox>
<asp:TextBox
ID="tbxpKey"
runat="server"
Visible="false"
Value="-1"
Width="300"></asp:TextBox>

</p><p>
<asp:label runat="server" ID="lblmpe2" text="Location: "></asp:label>
<asp:TextBox
ID="tbxSite"
runat="server"
CssClass="editrow" text=" "
Width="300"></asp:TextBox>
</p><p>
<asp:label runat="server" ID="lblmpe3" text="Start Date: "></asp:label>
<asp:TextBox
ID="tbxStarting"
runat="server"
CssClass="editrow" text=" "
Width="100"></asp:TextBox>
</p><p>
<asp:label runat="server" ID="lblmpe4" text="End Date: "></asp:label>
<asp:TextBox
ID="tbxEnding"
runat="server"
CssClass="editrow" text=" "
Width="100"></asp:TextBox>
</p><p>
<asp:label runat="server" ID="Label5" text="Hours: "></asp:label>
<asp:TextBox
ID="tbxHours"
runat="server"
CssClass="editrow" text=" "
Width="50"></asp:TextBox>
</p><p>
<asp:label runat="server" ID="lblmpe5" text="Trainers: "></asp:label>
<asp:TextBox
ID="tbxTeachers"
runat="server"
CssClass="editrow" text=" "
Width="300"></asp:TextBox>
</p><p>
<asp:ImageButton
ID="ImgBtnMpeSubmit"
OnClick="ImgBtnMpeSubmit_Click"
runat="server"
Height="30px"
ImageUrl="~/Buttons/lbSave.gif"
Width="81px"
onmouseover="this.src='buttons/lbSave.gif'"
onmouseout="this.src='buttons/lbSave_over.gif'"
/>
<asp:ImageButton
ID="btnClose"
runat="server"
Height="30px"
ImageUrl="~/Buttons/lbCancel.gif"
Width="81px"
onmouseover="this.src='buttons/lbCancel.gif'"
onmouseout="this.src='buttons/lbCancel_over.gif'"
/>
</p>
</div>

Code from the CodeBehind procedure to save the data:
Protected Sub ImgBtnMpeSubmit_Click(ByVal sender As Object, ByVal e As System.EventArgs)
SqlCourses.Insert()
End Sub
[CODE]