Click here to Skip to main content
       

ASP.NET

 
GeneralRe: s/m has to send mail on button click event PinmvpSandeep Mewara18-Feb-13 6:49 
GeneralRe: s/m has to send mail on button click event PinmemberMember 870181318-Feb-13 7:26 
Questionsending mail on button click event from the s/m PinmemberMember 870181318-Feb-13 5:15 
AnswerRe: sending mail on button click event from the s/m PinmvpSandeep Mewara18-Feb-13 6:00 
QuestionUsing Ajax in my project Pinmemberjaveed03518-Feb-13 3:32 
Questionweb service keep a process open Pinmemberdcof17-Feb-13 13:12 
AnswerRe: web service keep a process open PinmemberN a v a n e e t h17-Feb-13 17:15 
Questionerror in passing array parameter to a storedprocedure PinmemberMember 870181316-Feb-13 16:28 
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<script type="text/javascript">
    function EnableUpload() {
        if (document.getElementById("<%=txtApplicationFormId.ClientID %>").value != "" && document.getElementById("<%=FileUpload1.ClientID %>").value != "" && document.getElementById("<%=FileUpload2.ClientID %>").value != "" && document.getElementById("<%=FileUpload3.ClientID %>").value != "") {
             document.getElementById("<%=btnSubmit.ClientID %>").disabled = false;
         }
         else {
             document.getElementById("<%=btnSubmit.ClientID %>").disabled = true;
         }
     }
 
    </script>
<table width="100%" cellpadding="1" cellspacing="1">
<tr>
    <td align="left">
        &nbsp;</td>
    <td align="left" class="bgcolor" style="padding-left:10px">
        Application Id<asp:Label ID="Label1" runat="server" style="color: red;">*</asp:Label>
        </td>
    <td align="left" colspan="2">
        <asp:TextBox ID="txtApplicationFormId" runat="server"  MaxLength="20"  onChange = "javascript:EnableUpload();" ></asp:TextBox>
        <br />
        <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server"  Display="Dynamic"
            ControlToValidate="txtApplicationFormId" ErrorMessage="ApplicationId&nbsp;is&nbsp;required" ForeColor="Red"
            SetFocusOnError="True" ValidationGroup="submit"></asp:RequiredFieldValidator>
        </td>
    </tr>
<tr>
    <td align="left">
        &nbsp;</td>
    <td align="left" class="bgcolor" style="padding-left:10px">
        Document1<asp:Label ID="Label2" runat="server" style="color: red;">*</asp:Label>
        </td>
    <td align="left"  colspan="2">
        <asp:FileUpload ID="FileUpload1" runat="server"  onChange = "javascript:EnableUpload();" ></asp:FileUpload>
        <br />
        <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" Display="Dynamic"
            ControlToValidate="FileUpload1" ErrorMessage="Document1&nbsp;is&nbsp;required" ForeColor="Red"
            SetFocusOnError="True" ValidationGroup="submit"></asp:RequiredFieldValidator>
        </td>
    </tr>
<tr>
    <td align="left">
        &nbsp;</td>
    <td align="left" class="bgcolor" style="padding-left:10px" valign="top">
        Document2<asp:Label ID="Label3" runat="server" style="color: red;">*</asp:Label>
        </td>
    <td align="left"  colspan="2">
        <asp:FileUpload ID="FileUpload2" runat="server" onChange = "javascript:EnableUpload();" ></asp:FileUpload>
        <br />
             <asp:RequiredFieldValidator ID="RequiredFieldValidator3" runat="server" Display="Dynamic"
            ControlToValidate="FileUpload2" ErrorMessage="Document2&nbsp;is&nbsp;required"
            ForeColor="Red" SetFocusOnError="True" ValidationGroup="submit"></asp:RequiredFieldValidator>
        </td>
    </tr>
<tr>
    <td align="left">
        &nbsp;</td>
    <td align="left" class="bgcolor" style="padding-left:10px" valign="top">
        Document3<asp:Label ID="Label4" runat="server" style="color: red;">*</asp:Label>
        </td>
    <td align="left"  colspan="2">
        <asp:FileUpload ID="FileUpload3" runat="server"  onChange = "javascript:EnableUpload();" ></asp:FileUpload>
        <br />
     <asp:RequiredFieldValidator ID="RequiredFieldValidator4" runat="server" Display="Dynamic"
            ControlToValidate="FileUpload3" ErrorMessage="Document3&nbsp;is&nbsp;required"
            ForeColor="Red" SetFocusOnError="True" ValidationGroup="submit"></asp:RequiredFieldValidator>
        </td>
    </tr>
<tr>
    <td align="left">
        &nbsp;</td>
    <td align="left" class="bgcolor" style="padding-left:10px">
        Description
        </td>
    <td align="left"  colspan="2">
        <asp:TextBox ID="txtdescription" runat="server" TextMode="MultiLine" Width="58%"></asp:TextBox>
        </td>
    </tr>
<tr>
 <td align="center" colspan="4">
        <asp:Button ID="btnSubmit" runat="server" Text="Submit"
            ValidationGroup="submit" onclick="btnSubmit_Click" Enabled="False"/>
</table>
</td>
 </tr>
</ContentTemplate>
<Triggers>
 
<asp:PostBackTrigger ControlID="btnSubmit" />
 
</Triggers>
 
    </asp:UpdatePanel>
on codebehind file:
protected void btnSubmit_Click(object sender, EventArgs e)
        {
 

            try
 
            {
 HttpFileCollection hfc = Request.Files;
                fn = new string[hfc.Count];
docloc = new string[hfc.Count];
                for (int i = 0; i < hfc.Count; i++)
                {
 
                    HttpPostedFile hpf = hfc[i];
 
                    if (hpf.ContentLength > 0)
                    {
                        fn[i] = Path.GetFileName(hpf.FileName);
                        docloc[i] = Path.GetFullPath(hpf.FileName);
                        hpf.SaveAs(@"D:\testfiles\" + fn[i]);
}
                }
                int j = conn.insert_update_request("Insert", 6, Convert.ToString(docloc[0]),Convert.ToString(docloc[1]),Convert.ToString(docloc[2]), txtdescription.Text.ToString(), 1, txtApplicationFormId.Text.ToString());
            }
 
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
}
public int insert_update_request(string type, int usertypeid, string doc1location, string doc2location, string doc3location, string description, int statusid, string applicationid)
        {
            int i;
            try
            {
                connection.Open();
                    SqlCommand cmd = new SqlCommand("sp_insert_update_request", connection);
                    cmd.Connection = connection;
                    cmd.CommandType = CommandType.StoredProcedure;
                    cmd.Parameters.AddWithValue("@type", type);
                    cmd.Parameters.AddWithValue("@UserTypeId", usertypeid);
                    cmd.Parameters.AddWithValue("@Document1location", doc1location);
                    cmd.Parameters.AddWithValue("@Document2location", doc2location);
                    cmd.Parameters.AddWithValue("@Document3location", doc3location);
                    cmd.Parameters.AddWithValue("@descr", description);
                    cmd.Parameters.AddWithValue("@StatusId", statusid);
                    cmd.Parameters.AddWithValue("@ApplicationId", applicationid);
                    i = cmd.ExecuteNonQuery();
            }
            catch(Exception ex)
            {
                i = 0;
                Console.WriteLine(ex.Message);
            }
            finally
            {
                connection.Close();
            }
            return i;
        }
ALTER procedure [dbo].[sp_insert_update_request] 
(@type varchar(20),
@applicationid nvarchar(max),
@usertypeid int,
@doc1location nvarchar(max),
@doc2location nvarchar(max),
@doc3location nvarchar(max),
@description nvarchar(max),
@statusid int)
as
begin 
      if(@type = 'Insert')
      begin
         insert into Request(UserTypeId,Document1location,Document2location,Document3location,descr,StatusId,ApplicationId )
            values
            (@usertypeid,@doc1location,@doc2location,@doc3location,@description,@statusid,@applicationid)
      end
 
end
i am getting the following error....
Procedure or function 'sp_insert_update_request' expects parameter '@doc1location', which was not supplied.
pls suggest me ....how to solve this issue...i am struggling for the past 4 days....
AnswerRe: error in passing array parameter to a storedprocedure PinmvpSandeep Mewara16-Feb-13 18:18 
GeneralRe: error in passing array parameter to a storedprocedure PinmemberMember 870181316-Feb-13 20:45 
QuestionPublishing asp.net website on cpanel PinmemberArun kumar Gautam15-Feb-13 2:12 
AnswerRe: Publishing asp.net website on cpanel PinmemberRichard Deeming15-Feb-13 2:38 
Questionasp.net PinmemberMember 983745515-Feb-13 0:49 
AnswerRe: asp.net PinmemberMarco Bertschi15-Feb-13 2:43 
AnswerA quick tip for new members... PinmemberMarco Bertschi15-Feb-13 2:49 
AnswerRe: asp.net PinmvpSandeep Mewara15-Feb-13 10:07 
Questionasp.net PinmemberMember 983745515-Feb-13 0:47 
AnswerRe: asp.net PinmemberMarco Bertschi15-Feb-13 2:41 
Questionfileupload control PinmemberMember 870181314-Feb-13 20:58 
AnswerRe: fileupload control PinmvpSandeep Mewara15-Feb-13 10:09 
Questionhow to check the given string language weather it is marathi hindi or any other Pinmemberjalbaji13-Feb-13 8:57 
AnswerRe: how to check the given string language weather it is marathi hindi or any other PinmemberRichard Deeming13-Feb-13 9:44 
AnswerRe: how to check the given string language weather it is marathi hindi or any other PinmemberN a v a n e e t h13-Feb-13 19:14 
Questionvbscript question.. Pinmemberbuffering8313-Feb-13 0:48 
QuestionSelect only 1 checbox in a checkbox list Pinmemberberba12-Feb-13 23:21 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.


Advertise | Privacy | Mobile
Web03 | 2.8.141015.1 | Last Updated 20 Oct 2014
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid