Jan 31, 2012

Fileupload browse button without accompanying textbox



<%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default3.aspx.vb" Inherits="Default3" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
        <title>Test - file upload trick</title>
    <script type="text/javascript">
    function CallUpload()    
    {
        if(document.getElementById("FileUpload1").value=='')
        {
            document.getElementById("FileUpload1").click();
        }
        else if(document.getElementById("FileUpload2").value=='')
        {
            document.getElementById("FileUpload2").click();        
        }
        else if(document.getElementById("FileUpload3").value=='')
        {
            document.getElementById("FileUpload3").click();        
        }        
     
        return false;
    }
    function AddToList(evt)
    {
         var myOption; 

            myOption = document.createElement("Option"); 
            myOption.text = evt;
            myOption.value = evt;
            document.getElementById("lstFiles").add(myOption);
    }
    </script>
</head>
<body>
    <form id="form1" runat="server">
    <div>
         <br />
    add upto 3 files<br />
    
    <asp:FileUpload ID="FileUpload1" runat="server" Width="514px" onchange="javascript:AddToList(this.value);" style="display:none;"/>
    <asp:LinkButton ID="q0" runat="server" Text="link1" OnClientClick="return CallUpload();"></asp:LinkButton>
    <br />
    
    <asp:FileUpload ID="FileUpload2" runat="server" Width="514px" 
        onchange="javascript:AddToList(this.value);" style="display:none;"/>
    <br />
    
    <asp:FileUpload ID="FileUpload3" runat="server" Width="514px" 
        onchange="javascript:AddToList(this.value);" style="display:none;"/>
    <br />
    <asp:ListBox ID="lstFiles" runat="server" Width="221px"></asp:ListBox>
         <br />
         <br />
         <asp:Button ID="Upload" runat="server" Text="Button" />
    <br />
    
    </div>
    </form>
</body>
</html>
 
 
 
 
 
 
 
 
 
---------------------------In Code ------------------
 
 
 
    Protected Sub Upload_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Upload.Click
        If Not FileUpload1.PostedFile.FileName = "" Then
            FileUpload1.PostedFile.SaveAs("file save path goes here")
        End If
        If Not FileUpload2.PostedFile.FileName = "" Then
            FileUpload2.PostedFile.SaveAs("file save path goes here")
        End If
        If Not FileUpload3.PostedFile.FileName = "" Then
            FileUpload3.PostedFile.SaveAs("file save path goes here")
        End If
    End Sub
  
 
 

Jan 23, 2012

How to Get Columns Data In Single Row with cumma (,) Separated in Sql server 2005

 SELECT STUFF(
 (
     SELECT  ', ' + VALUE      FROM
     (
       SELECT VALUE  FROM dbo.Split('DPTHD,UH,IH,FH,LH,DH,IS', ',')
       
     ) AS T FOR XML PATH('')
 )
 ,1,1,'') AS [VALUE]

=======================================================================

use Split Function

CREATE FUNCTION dbo.Split
(
@RowData nvarchar(2000),
@SplitOn nvarchar(5)
)
RETURNS @RtnValue table
(
Id int identity(1,1),
Data nvarchar(100)
)
AS
BEGIN
Declare @Cnt int
Set @Cnt = 1

While (Charindex(@SplitOn,@RowData)>0)
Begin
Insert Into @RtnValue (data)
Select
Data = ltrim(rtrim(Substring(@RowData,1,Charindex(@SplitOn,@RowData)-1)))

Set @RowData = Substring(@RowData,Charindex(@SplitOn,@RowData)+1,len(@RowData))
Set @Cnt = @Cnt + 1
End

Insert Into @RtnValue (data)
Select Data = ltrim(rtrim(@RowData))

Return
END


Jan 4, 2012

Pass multiple table to SAP

use link
1 ) http://stackoverflow.com/questions/8157561/how-to-pass-multiple-tables-to-sap-using-irfc-funtions-from-net
or
2) http://stackoverflow.com/questions/8140087/how-to-add-multiple-rows-to-irfctable


============================================================================
1)

IRfcFunction orderDetails = _rfcDest.Repository.CreateFunction(strBapi);

        RfcStructureMetadata metaData = _rfcDest.Repository.GetStructureMetadata("ZBAPI_A_STRU_ORDER_CREATE_PART");

        IRfcStructure structPartners = metaData.CreateStructure();
        structPartners.SetValue("PARTN_ROLE", "SP");
        structPartners.SetValue("PARTN_NUMB", "110024");

        IRfcTable tblPartner = orderDetails.GetTable("PARTNERS");
        tblPartner.Append(structPartners);

        structPartners = metaData.CreateStructure();
        structPartners.SetValue("PARTN_ROLE", "SH");
        structPartners.SetValue("PARTN_NUMB", "110005");


        tblPartner.Append(structPartners);
        orderDetails.SetValue("PARTNERS", tblPartner);



        metaData = _rfcDest.Repository.GetStructureMetadata("ZBAPI_A_STRU_ORDER_CREATE_COND");
        IRfcStructure structConditions = metaData.CreateStructure();
        structConditions.SetValue("ITM_NUMBER", "10");
        structConditions.SetValue("COND_TYPE", "PR00");
        structConditions.SetValue("COND_VALUE", "30");
        structConditions.SetValue("CURRENCY", "USD");

        IRfcTable tblConditions = orderDetails.GetTable("CONDITIONS");
        tblConditions.Append(structConditions);
        orderDetails.SetValue("CONDITIONS", tblConditions);

        metaData = _rfcDest.Repository.GetStructureMetadata("ZBAPI_A_STRU_ORDER_CREATE_ITEM");
        IRfcStructure structItems = metaData.CreateStructure();
        structItems.SetValue("MATERIAL", "F500");
        structItems.SetValue("TARGET_QTY", "3");

        IRfcTable tblItems = orderDetails.GetTable("ITEMS");
        tblItems.Append(structItems);
        orderDetails.SetValue("ITEMS", tblItems);

        RfcSessionManager.BeginContext(_rfcDest);
        orderDetails.Invoke(_rfcDest);

        IRfcStructure bapiTable = orderDetails.GetStructure("RETURN");

        RfcSessionManager.EndContext(_rfcDest);


Jan 3, 2012

Add Dynamic Image in Crystal Reports

use below link....

http://www.codeproject.com/KB/vb/Image_in_Crystal_Reports.aspx?fid=476891&fr=1#xx0xx

What is the use of n-tier architecture and 3-tier architecture?

how to implement 3-tier architecture in asp.net using c#. 3-Tier architecture is also called layered architecture. Some people called it ...