Click here to Skip to main content
15,884,629 members
Home / Discussions / ASP.NET
   

ASP.NET

 
GeneralRe: s/m has to send mail on button click event Pin
Sandeep Mewara18-Feb-13 6:49
mveSandeep Mewara18-Feb-13 6:49 
GeneralRe: s/m has to send mail on button click event Pin
Member 870181318-Feb-13 7:26
Member 870181318-Feb-13 7:26 
Questionsending mail on button click event from the s/m Pin
Member 870181318-Feb-13 5:15
Member 870181318-Feb-13 5:15 
AnswerRe: sending mail on button click event from the s/m Pin
Sandeep Mewara18-Feb-13 6:00
mveSandeep Mewara18-Feb-13 6:00 
QuestionUsing Ajax in my project Pin
javeed03518-Feb-13 3:32
javeed03518-Feb-13 3:32 
Questionweb service keep a process open Pin
dcof17-Feb-13 13:12
dcof17-Feb-13 13:12 
AnswerRe: web service keep a process open Pin
N a v a n e e t h17-Feb-13 17:15
N a v a n e e t h17-Feb-13 17:15 
Questionerror in passing array parameter to a storedprocedure Pin
Member 870181316-Feb-13 16:28
Member 870181316-Feb-13 16:28 
XML
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>

XML
<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">

XML
<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>

XML
<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>

XML
<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>

XML
<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>

XML
<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>

XML
<tr>
 <td align="center" colspan="4">
        <asp:Button ID="btnSubmit" runat="server" Text="Submit"
            ValidationGroup="submit" onclick="btnSubmit_Click" Enabled="False"/>

</table>

</td>
 </tr>

XML
</ContentTemplate>
<Triggers>

<asp:PostBackTrigger ControlID="btnSubmit" />

</Triggers>

    </asp:UpdatePanel>

on codebehind file:
C#
protected void btnSubmit_Click(object sender, EventArgs e)
        {


            try

            {

HttpFileCollection hfc = Request.Files;
               fn = new string[hfc.Count];

C#
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]);

SQL
}
                }
                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);
            }
}

C#
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 Pin
Sandeep Mewara16-Feb-13 18:18
mveSandeep Mewara16-Feb-13 18:18 
GeneralRe: error in passing array parameter to a storedprocedure Pin
Member 870181316-Feb-13 20:45
Member 870181316-Feb-13 20:45 
QuestionPublishing asp.net website on cpanel Pin
Arun kumar Gautam15-Feb-13 2:12
Arun kumar Gautam15-Feb-13 2:12 
AnswerRe: Publishing asp.net website on cpanel Pin
Richard Deeming15-Feb-13 2:38
mveRichard Deeming15-Feb-13 2:38 
Questionasp.net Pin
Member 983745515-Feb-13 0:49
Member 983745515-Feb-13 0:49 
AnswerRe: asp.net Pin
Marco Bertschi15-Feb-13 2:43
protectorMarco Bertschi15-Feb-13 2:43 
AnswerA quick tip for new members... Pin
Marco Bertschi15-Feb-13 2:49
protectorMarco Bertschi15-Feb-13 2:49 
AnswerRe: asp.net Pin
Sandeep Mewara15-Feb-13 10:07
mveSandeep Mewara15-Feb-13 10:07 
Questionasp.net Pin
Member 983745515-Feb-13 0:47
Member 983745515-Feb-13 0:47 
AnswerRe: asp.net Pin
Marco Bertschi15-Feb-13 2:41
protectorMarco Bertschi15-Feb-13 2:41 
Questionfileupload control Pin
Member 870181314-Feb-13 20:58
Member 870181314-Feb-13 20:58 
AnswerRe: fileupload control Pin
Sandeep Mewara15-Feb-13 10:09
mveSandeep Mewara15-Feb-13 10:09 
Questionhow to check the given string language weather it is marathi hindi or any other Pin
jalbaji13-Feb-13 8:57
professionaljalbaji13-Feb-13 8:57 
AnswerRe: how to check the given string language weather it is marathi hindi or any other Pin
Richard Deeming13-Feb-13 9:44
mveRichard Deeming13-Feb-13 9:44 
AnswerRe: how to check the given string language weather it is marathi hindi or any other Pin
N a v a n e e t h13-Feb-13 19:14
N a v a n e e t h13-Feb-13 19:14 
Questionvbscript question.. Pin
buffering8313-Feb-13 0:48
buffering8313-Feb-13 0:48 
QuestionSelect only 1 checbox in a checkbox list Pin
berba12-Feb-13 23:21
berba12-Feb-13 23:21 

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

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