Quantcast
Channel: CodeProject Latest postings for ASP.NET
Viewing all 3938 articles
Browse latest View live

Building DOM from xml - asp.net controls, or html controls?

$
0
0
Hi.
 
I´ve been creating web pages for some years now, and been moving away from creating asp.net page-controls from codebehind because of the overhead they generate and the postback challenges you encounter. Instead I´ven been relying on javascript, jquery, old-school html elements and webservices, since they give me more elegant and light solutions.
 
The challenge I face now, is that it should be possible to construct a page based on a xml-setup file. The page design is luckily quite simple. It´s basically a vertical page with controls on top of each other.
I´m planning to create xml elements/types that define each control with it´s attributes. For an example a textbox with a css class, numeric text only value, which method to fire on textchanged, etc.. Or a button with a width, height, text, which (javascript?) method to fire upon click. Based on these types, I create the controls on the page.
 
My question is, should I create and insert these controls from codebehind, that means asp.net controls?
Or should I, for an example, build the dom in codebehind and let the javascript get the DOM from webservice, and then inject it on the page? Or what would be a good approach to this problem?
 
Thank you in advance Smile | :)
 
Kind regards,
Lars

What is this doing

$
0
0
<input type="submit" name="ctl00$ContentPlaceHolder$btnCancelNotification" value="Yes" onclick="javascript:WebForm_DoPostBackWithOptions(new WebForm_PostBackOptions("ctl00$ContentPlaceHolder$btnCancelNotification", "", true, "", "", false, false))" id="ctl00_ContentPlaceHolder_btnCancelNotification" class="cBtnRight" progressmessage="Saving…" style="width:70px;">

Multi tenancy

$
0
0
Hi, anybody knows a good source to build a multi tenant application in aspnet?
 
I'm studying this paper[^] but i'm not finding any good source code to learn how to do. Maybe some good practices to code this kind of application...
 
tnx

call javascript in button1_click in bihindcode

$
0
0
Hi,
How i can call javascript OK function in click event of btnOK :
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="GridviewGhataKhadamat.aspx.cs"
    Inherits="Tina.WebUI.WorkFlows.Forms.Khadamat.GridviewGhataKhadamat"%> 
<!DOCTYPEhtmlPUBLIC"-//W3C//DTDXHTML1.0Transitional//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><htmlxmlns="http://www.w3.org/1999/xhtml"><headrunat="server"><title></title> 
    <scripttype="text/javascript">
        function Close() {
            window.close();
        }
       
        function OK(Id,Name,Code) {
 
            var vReturnValue = newObject();
            vReturnValue.Id = Id;
            vReturnValue.Name = Name;
            vReturnValue.Code = Code;  
            window.returnValue = vReturnValue;
            window.close();
        } 
        
    </script> 
</head><body><formid="form1"runat="server"><div><%-- <asp:HiddenField ID="GridviewTypeT" runat="server" />--%><asp:GridViewID="gvGhataKhadamat"runat="server"AutoGenerateColumns="False"BackColor="White"BorderColor="#CC9966"BorderStyle="Inset"BorderWidth="1px"CellPadding="4"Font-Names="Verdana"><FooterStyleBackColor="#FFFFCC"ForeColor="#330099"/><Columns><asp:TemplateFieldHeaderText=""><ItemTemplate><inputname="rbGhataKhadamat"type="radio"value="<%# Eval("Id")%>,<%# Eval("Name") %>,<%# Eval("Code") %>" />
                    </ItemTemplate></asp:TemplateField><asp:BoundFieldDataField="Id"HeaderText="ID"Visible="false"/><asp:BoundFieldDataField="Code"HeaderText="<%$ Resources:Khadamat, Code %>"/><asp:BoundFieldDataField="Name"HeaderText="<%$ Resources:Khadamat, Name %>"/></Columns><RowStyleBackColor="White"ForeColor="#330099"/><SelectedRowStyleBackColor="#FFCC66"Font-Bold="True"ForeColor="#663399"/><PagerStyleBackColor="#FFFFCC"ForeColor="#330099"HorizontalAlign="Center"/><HeaderStyleBackColor="#990000"Font-Bold="True"ForeColor="#FFFFCC"/></asp:GridView></div><asp:Buttonrunat="server"ID="btnOk"Text="<%$ Resources:Khadamat, ok %>"OnClick="btnOk_Click"/><asp:Buttonrunat="server"ID="btnCancel"Text="<%$ Resources:Khadamat, cancel %>"OnClientClick="Close()"/></form></body></html>
 
and this is bihind code
 
protectedvoid btnOk_Click(object sender, EventArgs e)
        {
            
            string[] strSelected=Request.Form["rbGhataKhadamat"].Split(newchar[]{','});
            Page.ClientScript.RegisterStartupScript(GetType(), "OK", "OK(" + "'" + strSelected[0] + "','" + strSelected[1] + "','" + strSelected[2] + "'"+");", true);
             
        }
 
 
it doesnt call OK function.
 
id didnt used onclientclick event cause i must pass the selected grid values.
 
thanks in advanced!

Back Page link with Attachment asp.net 4

$
0
0
Thanks in advance.
 
Front End : Asp.net 4 (vb)
 
On a Page i have a button which redirects to another Page
response.redirect("Page2.aspx" + "?ID="& DocumentID)
 
on Page2 load event through querystring i get the Document ID and Open the Document (PDF/IMAGE etc), My Problem is on this Page2, I want to have a button with back page link but the button does not show as the page is loaded, So is there any way to show back link along with the document.
To kill a DEER, You need Guns, knives, Ropes and many people to help But To kill
a DEAR,
You need just ignorance and silence

adsense alternatives

$
0
0
Hi,
 
I would like to ask if there are any free good alternatives for Google adsense to place ads on my websites and earn money form it?

Tab index with firefox issue

$
0
0
Hi All,
 

When i am hitting Enter key after focused to a button with tab key , nothing is happening , but when i am hitting spacebar ,it is working (in Firefox) . What will be the issue . Please help
 
Thanks
Rks

COMPILATION error "object reference not set to an instance of an object"

$
0
0
I use VS2010. When I try to add WCF service to my project and rebuild the solution, I receive COMPILATION error
"object reference not set to an instance of an object" Cry | :((
Without WCF service everything looks fine.

Schedule and post comments to FaceBook wall using ASP.Net

$
0
0
Hi
 
i want to develop application like hootsuite . com
 
Schedule the FaceBook wall using ASP.Net
 
now i am geting this error
 
my new facebook code is : AQCk3-RCylaaLxWxl9HInFJYAP0Cm-v0nXjWhwEI9cswEMXuKvibzJWYb6tlSqPlFYbpYapEiP0t1Sir6f2A76QR67LcVNXOSq-cfTEW-56HXNIJUFkvJsjnLU-Brs_x6YtAnEs3H6bBOjGwq8zCWhkMbXK8I6kag6HPqU406DzenPZx3QyYJzUjFrl9_zbJrLK7qv4CsifWrtL19oKQaIDU#_=_
 
so, my url like https://graph.facebook.com/oauth/access_token?client_id=134941433319444&client_secret=be06862cbacb4f84f5112ebcc4bc3b2c&grant_type=fb_exchange_token&fb_exchange_token=AQCk3-RCylaaLxWxl9HInFJYAP0Cm-v0nXjWhwEI9cswEMXuKvibzJWYb6tlSqPlFYbpYapEiP0t1Sir6f2A76QR67LcVNXOSq-cfTEW-56HXNIJUFkvJsjnLU-Brs_x6YtAnEs3H6bBOjGwq8zCWhkMbXK8I6kag6HPqU406DzenPZx3QyYJzUjFrl9_zbJrLK7qv4CsifWrtL19oKQaIDU#_=_

but , still i get error like
 
{
"error": {
"message": "Malformed access token AQCk3-RCylaaLxWxl9HInFJYAP0Cm-v0nXjWhwEI9cswEMXuKvibzJWYb6tlSqPlFYbpYapEiP0t1Sir6f2A76QR67LcVNXOSq-cfTEW-56HXNIJUFkvJsjnLU-Brs_x6YtAnEs3H6bBOjGwq8zCWhkMbXK8I6kag6HPqU406DzenPZx3QyYJzUjFrl9_zbJrLK7qv4CsifWrtL19oKQaIDU",
"type": "OAuthException",
"code": 190
}
}

Buttons are not working for enterkey press

$
0
0
<dxpc:ASPxPopupControlID="mdlFileDupCheck"runat="server"PopupHorizontalAlign="WindowCenter"CloseAction="CloseButton"PopupVerticalAlign="WindowCenter"AllowDragging="True"EnableAnimation="False"AutoUpdatePosition="true"EnableViewState="true"ShowHeader="false"ClientInstanceName="mdlFileDupCheck"Modal="true"ShowPageScrollbarWhenModal="true"BackColor="#F3F3F3"><ContentCollection><dxpc:PopupControlContentControlID="PopupControlContentControl1"runat="server"><dxp:ASPxPanelID="Panel1"runat="server"CssClass="box nomargin"><PanelCollection><dxp:PanelContentID="PanelContent1"runat="server"><asp:Panelrunat="server"ID="pnlFileDupCheck"DefaultButton="btnFileDupCheck"Style="width: 825px;
                                                display: "><asp:ButtonID="btnFileDupCheck"runat="server"Style="display: none;"/><dx:ASPxPageControlID="pageControl"runat="server"ActiveTabIndex="0"Width="100%"TabSpacing="9px"CssPostfix="myTheme"OnActiveTabChanged="pageControl1_ActiveTabChanged"AutoPostBack="true"><ClientSideEventsTabClick="function(s, e) {
                                                                     var index=s.GetActiveTabIndex();
                                                                    if(index==e.tab.index)
                                                                    {
                                                                     e.Cancel = true;
                                                                    }
                                                                    else
                                                                    {
                                                                        LoadingPanel.Show();
                                                                    }
                                                                   
                                                                    }"/><TabPages><dx:TabPageText="File Information"TabStyle-Width="135px"><ContentCollection><dx:ContentControlID="ContentControl4"runat="server"><divclass="withborder"><divclass="box nomargin"><tablecellpadding="0"cellspacing="0"style="width: 100%"border="0"><tr><tdclass="cFormHeader"><h3>EnterFileInformation</h3></td><tdclass="required"align="right">*Required</td></tr></table><divclass="hr"></div><divclass="cMessageArea"><asp:LabelID="lblMdlErrorMsg"runat="server"CssClass="cError"></asp:Label></div><tableclass="cChildTable"width="100%"><tr><!--<td><table><tr>--><tdstyle="width: 10%"><divclass="required">*<asp:LabelID="lblFile"runat="server"Text="File #:"CssClass="cLabel"></asp:Label></div></td><tdstyle="width: 50%"><asp:TextBoxID="txtFileNumber"runat="server"CssClass="cText"Width="150px"MaxLength="40"TabIndex="1"></asp:TextBox></td><%--<tdstyle="width: 15%"><divclass="required">*<asp:LabelID="lblPropertyType"runat="server"Text="Property Type:"CssClass="cLabel"></asp:Label></div></td><tdcolspan="2"><asp:DropDownListID="ddlPropertyType"runat="server"CssClass="cSelect"TabIndex="8"ToolTip="Residential means real property having a house, individual condominium unit, mobile home permanently affixed to real estate, or other dwelling unit intended principally for the occupancy of from one to four (1-4) families."></asp:DropDownList><asp:ImageButtonImageUrl="/images/pdf_online_btn.gif"runat="server"Width="20px"ID="btnPropertyTypePD"OnClientClick="return openPropertyType()"Style="position: relative;
                                                                    top: 1px"/></td>--%><!--</tr></table></td>--></tr><tr><!--<td><table><tr>--><tdstyle="width: 10%"><divclass="required">*<asp:LabelID="lblOffice"runat="server"Text="Office:"Width=""CssClass="cLabel"></asp:Label></div></td><tdstyle="width: 50%"><asp:DropDownListID="ddlOffice"runat="server"CssClass="cSelect"AutoPostBack="true"TabIndex="6"OnSelectedIndexChanged="ddlOffice_SelectedIndexChanged"Width="380px"onchange="LoadingPanel.Show();"></asp:DropDownList></td><tdstyle="width: 15%"><divclass="required">*<asp:LabelID="lblUnderwriter"runat="server"Text="Underwriter:"Width=""CssClass="cLabel"></asp:Label></div></td><td><asp:DropDownListID="ddlUnderwriters"runat="server"CssClass="cSelect"OnSelectedIndexChanged="ddlUnderwriters_SelectedIndexChanged"AutoPostBack="true"TabIndex="9"Width="150px"onchange="LoadingPanel.Show();"></asp:DropDownList></td></tr><tr><tdstyle="width: 10%"><divclass="required">*<asp:LabelID="lblState"runat="server"Text="State:"Width=""CssClass="cLabel"></asp:Label></div></td><tdstyle="width: 50%"><asp:DropDownListID="ddlJurisdictionStates"runat="server"CssClass="cSelect"TabIndex="7"OnSelectedIndexChanged="ddlJurisdictionStates_SelectedIndexChanged"AutoPostBack="true"onchange="LoadingPanel.Show();"></asp:DropDownList></td><tdstyle="width: 15%"><divclass="required">*<asp:LabelID="lblAccount"runat="server"Text="Account #:"Width=""CssClass="cLabel"></asp:Label></div></td><td><asp:DropDownListID="ddlAccount"runat="server"CssClass="cSelect"TabIndex="10"></asp:DropDownList></td><!--</tr></table></td>--></tr></table><divid="divDuplicateFiles"runat="server"visible="false"><divclass="Space"></div><divclass="cFormHeader"><h3>File#Validation</h3></div><divclass="hr"></div><divclass="Space"></div><divclass="cMessageArea"><asp:LabelID="lblDuplicateFileMsg"runat="server"CssClass="cError"Text=""></asp:Label></div><divclass="Space"></div><div><dx:ASPxGridViewID="dgDuplicateFile"runat="server"AutoGenerateColumns="False"EnableCallBacks="False"Visible="True"Width="100%"KeyFieldName="FileId"OnHtmlRowCreated="dgDuplicateFile_HtmlRowCreated"OnBeforeColumnSortingGrouping="dgDuplicateFile_BeforeColumnSortingGrouping"OnPageIndexChanged="dgDuplicateFile_OnPageIndexChanged"OnRowCommand="dgDuplicateFile_RowCommand"><Columns><dx:GridViewDataTextColumnFieldName="FileId"Visible="False"VisibleIndex="0"></dx:GridViewDataTextColumn><dx:GridViewDataTextColumnCaption="File #"FieldName="FileNumber"VisibleIndex="1"><HeaderCaptionTemplate><divclass="cGridHeaderLink"onmouseout="RemoveMouseOverClass(this)"onmouseover="addMouseOverClass(this)">File#</div></HeaderCaptionTemplate></dx:GridViewDataTextColumn><dx:GridViewDataColumnName="Office"Caption="Office"VisibleIndex="2"FieldName="Office"CellStyle-HorizontalAlign="Left"><HeaderCaptionTemplate><divclass="cGridHeaderLink"onmouseover="addMouseOverClass(this)"onmouseout="RemoveMouseOverClass(this)">Office</div></HeaderCaptionTemplate><DataItemTemplate><div><asp:LabelID="lblOfficeName"runat="server"></asp:Label></div></DataItemTemplate></dx:GridViewDataColumn><dx:GridViewDataDateColumnCaption="Open Date"FieldName="OpenDate"VisibleIndex="3"Settings-SortMode="Value"SortOrder="Descending"SortIndex="1"><PropertiesDateEditDisplayFormatString="MM/dd/yyyy"EditFormat="Custom"EditFormatString="MM/dd/yyyy"UseMaskBehavior="true"></PropertiesDateEdit><HeaderCaptionTemplate><divclass="cGridHeaderLink"onmouseout="RemoveMouseOverClass(this)"onmouseover="addMouseOverClass(this)">OpenDate</div></HeaderCaptionTemplate></dx:GridViewDataDateColumn><dx:GridViewDataTextColumnCaption="Address"FieldName="FullAddress"VisibleIndex="4"><HeaderCaptionTemplate><divclass="cGridHeaderLink"onmouseout="RemoveMouseOverClass(this)"onmouseover="addMouseOverClass(this)">Address</div></HeaderCaptionTemplate></dx:GridViewDataTextColumn><dx:GridViewDataColumnName="ProductDesc"Caption="Buyer/Seller"VisibleIndex="5"FieldName="Buyer"CellStyle-HorizontalAlign="Left"><HeaderCaptionTemplate><divclass="cGridHeaderLink"onmouseover="addMouseOverClass(this)"onmouseout="RemoveMouseOverClass(this)">Buyer/Seller</div></HeaderCaptionTemplate><DataItemTemplate><div><asp:LabelID="lblBuyerSeller"runat="server"></asp:Label></div></DataItemTemplate></dx:GridViewDataColumn><dx:GridViewDataColumnVisibleIndex="6"Caption="Action"><HeaderCaptionTemplate><divclass="cGridHeaderStyle">Action</div></HeaderCaptionTemplate><DataItemTemplate><divclass="cLinkButton"><asp:LinkButtonID="lblFileOpen"runat="server"Text="Open"CommandArgument="Open"CommandName="Open"/></div></DataItemTemplate><SettingsAllowSort="False"/></dx:GridViewDataColumn><dx:GridViewDataTextColumnFieldName="FirmLocationId"Visible="False"VisibleIndex="7"></dx:GridViewDataTextColumn><dx:GridViewDataTextColumnFieldName="FileExists"Visible="False"VisibleIndex="8"SortOrder="Descending"SortIndex="0"></dx:GridViewDataTextColumn><dx:GridViewDataTextColumnFieldName="FirmLocationJurisdictionID"Visible="False"VisibleIndex="9"></dx:GridViewDataTextColumn></Columns><StylesHeader-CssClass="dxgvHeader"HeaderPanel-Cursor="hand"><RowHotTrackBackColor="#DAE0E6"></RowHotTrack><HeaderCssClass="dxgvHeader"></Header><Cell><BorderRightBorderStyle="None"/></Cell><HeaderPanelCursor="hand"></HeaderPanel></Styles><SettingsPagerAllButton-Visible="true"FirstPageButton-Visible="true"LastPageButton-Visible="true"PageSize="10"Position="Top"ShowDefaultImages="true"><AllButtonVisible="True"></AllButton><FirstPageButtonVisible="True"></FirstPageButton><LastPageButtonVisible="True"></LastPageButton></SettingsPager><SettingsDetailIsDetailGrid="True"/><SettingsBehaviorAllowSort="true"EnableRowHotTrack="true"ProcessSelectionChangedOnServer="True"SortMode="Custom"/><StylesCell-BorderRight-BorderStyle="None"><RowHotTrackBackColor="#dae0e6"></RowHotTrack></Styles><SettingsLoadingPanelText="Loading,Please wait..."/></dx:ASPxGridView></div></div></div><divclass="buttons"><spanid="span3"class="cBtnLeft"><spanclass="cBtnMid"><spanclass="cBtnRight"><asp:ButtonID="btnDupCheck"runat="server"OnClientClick="LoadingPanel.Show();"OnClick="btnDupCheck_Click"Text="Next"CssClass="cBtnRight"Width="60px"TabIndex="11"/></span></span></span><spanid="span4"class="cBtnLeft"><spanclass="cBtnMid"><spanclass="cBtnRight"><asp:ButtonID="btnCncl"runat="server"Text="Cancel"OnClick="btnCncl_OnClick"OnClientClick="LoadingPanel.Show();"CssClass="cBtnRight"Width="60px"TabIndex="12"/></span></span></span><inputtype="hidden"id="hidtxtFileNumber"runat="server"/><inputtype="hidden"id="hidtxtOfficeId"runat="server"/><inputtype="hidden"id="hidtxtStateId"runat="server"/><inputtype="hidden"id="hidtxtPropertyType"runat="server"/></div></div></dx:ContentControl></ContentCollection></dx:TabPage><dx:TabPageText="Property Information"TabStyle-Width="140px"><ContentCollection><dx:ContentControlID="ContentControl5"runat="server"><tableborder="0"width="100%"><tr><tdstyle="height: 90%"><uc1:findAddressID="ctlFindAddress"runat="server"></uc1:findAddress></td></tr></table></dx:ContentControl></ContentCollection></dx:TabPage></TabPages></dx:ASPxPageControl></asp:Panel></dxp:PanelContent></PanelCollection></dxp:ASPxPanel></dxpc:PopupControlContentControl></ContentCollection></dxpc:ASPxPopupControl>

Return multiple result set to Generic List

$
0
0
Hi,
My procedure return multiple result set. I need to assign it to generic list.
How can i work a generic list like dataset do?
I am using it in web service, so i avoid using dataset. I want the result in List<>
 
Thankyou
YPKI

web service creation

$
0
0
We are in the process of developing an inventory tracking system and one part of this system is the automation of the Change of Location (COL) form. We have the database developed; we have the electronic form developed; we are now at a halt because we need this web service inorderto move forward.
 

 
1We are in need of a web service to transmit information between Sharepoint and an Infopath form.
 

2.We will set up your web service as a data connection and work with the form through this connection

Remove tick/check box from ASP.NET Checkbox control

$
0
0
Hello guys !
 
I have this CheckBoxList control and to each ListItem of it, have set the Text property to the img HTML tag so it displays an image.
 
I am trying to remove the tick/check box from the checkboxes of a ASP.NET CheckBoxList control when i click on each item.
 
My code does this. Every time i click on some check box, the **SelectedIndexChanged** event fires up and it does some saving of some data in my database. And when the saving is done and the page is refreshed i want to check/tick box of the checkbox item that was clicked not to be there anymore and the checkbox to be disabled cause i don't want the user to able able to click it again. I have tried to tried to set the Enable and Selected properties to False, and also add an attribute to the CheckboxList control, but without success. Here is my code.
 

<asp:CheckBoxListID="Services"runat="server"RepeatColumns="5"CellPadding="10"CellSpacing="15"RepeatLayout="Table"Font-Size="Large"RepeatDirection="Vertical"TextAlign="Right"AutoPostBack="true"EnableViewState="true"> 
    <asp:ListItemValue="Facebook"Text="<img src='/ServiceIcons/facebook.png'  
    title='Facebook' />"/><asp:ListItemValue="Googleplus"Text="<img src='/ServiceIcons/googleplus.png' 
    title='Google+' />"/><asp:ListItemValue="LinkedIn"Text="<img src='/ServiceIcons/linkedin.png' 
    title='LinkedIn' />"/><asp:ListItemValue="RSS"Text="<img src='/ServiceIcons/rss.png' title='RSS' />"/><asp:ListItemValue="Skype"Text="<img src='/ServiceIcons/skype.png' title='Skype' />"/></asp:CheckBoxList>
 

And in the code behind i do this:
 
PrivateSub Services_SelectedIndexChanged(ByVal sender AsObject, ByVal e As 
      System.EventArgs) Handles Services.SelectedIndexChanged
        
           -----Storing to database code here------
 
            Services.Items(Services.SelectedIndex).Enabled = False
            Services.Items(Services.SelectedIndex).Attributes.Add("class", 
            "displayCheckBox")
            Services.Items(Services.SelectedIndex).Selected = False 
      EndSub
 
And the css class here:
 
.displayCheckBox input{background:Green;}
 
After the the event does the storing in the databse, page refreshed the checkbox that was selected is disabled but it shows the tick/check box, and i don't want it to show it if is selected.
 
Any one has an idea. I have searched a lot, but it seems that the CheckBoxList control doesn't provide much costumizing options.
 
Thank you in advance !

Checking the size of a cookie

$
0
0
I want to write some tracking information to a cookie. When the cookie reaches it's max size I want to overwrite the final value or 2.
 
How do I check the size of a cookie though.

Problem With List View

$
0
0
In totl i got total price but i am not able to display it... Loop is not go in Else Loop.............
 
<asp:ListViewID="lstViewCart_History"runat="server"OnPreRender="lstViewCart_History_PreRender"OnItemDataBound="lstViewCart_History_OnItemDataBound"ItemPlaceholderID="PlaceHolder1"><LayoutTemplate><tablewidth="40%"><thead><tr><td><%# Eval("order_pid")%></td></tr><tr><td></td></tr><tr><td></td></tr></thead><tbody><asp:PlaceHolderID="PlaceHolder1"runat="server"></asp:PlaceHolder></tbody><tr><tdcolspan="8"align="right">
Total Amount
</td><tdcolspan="2"align="left"><br/>
$<asp:LabelID="lblw"runat="server"Text=""></asp:Label></td></tr></table></LayoutTemplate><ItemTemplate><table><tr><td><table><tr><td>
Book Name
</td><td>
Author
</td><td>
ISBN
</td><td>
Order Number
</td><td>
Order Date
</td><td>
Quantity
</td><td>
Price
</td><td>
Total Price
</td></tr><tr><td><%# Eval("cartdetail_pname")%></td><td><%# Eval("cartdetail_author")%></td><td><%# Eval("cartdetail_isbn")%></td><td><%# Eval("order_pid")%></td><td><%# Eval("order_date")%></td><td><%# Eval("cartdetail_qty")%></td><td>
$<%# Eval("cartdetail_price")%></td><td>
$<asp:Labelrunat="server"ID="total_price"Text='<%#Eval("total_price")%>'></asp:Label></td></tr></table></td></tr></table></ItemTemplate> 
</asp:ListView> 
protected void lstViewCart_PreRender(object sender, EventArgs e)
{
Label lblTot = this.ListView1.FindControl("lblGrandTotal") as Label;
if (lblTot == null)
{
 
}
else
{
lblTot.Text = totl.ToString();
}
}
 
Thanks for giving time to read my problem and also for your valuable suggestions.
 
Gaurav Bhandari

Paypal Website Payments Standard Integration using NVP

$
0
0
Hello Everyone,
 
I'm trying to integrate Paypal Website Payments Standard into my eStore.
 
I would like to roll my own solution and cannot make sense of the paypal documentation, its very sprawling and there are so many sections that its confusing to say the least.
 
I'm not intending to use PDT or IPN I will use the RETURN variable to assess if the payment went through okay or failed.
 
Maybe at a later date I will integrate PDT and IPN too.
 
I think I can handle the calling and processing the returns.
 
But I'm stuck at some very basic levels....
 
1 - Is this a suitable solution for live use? (no PDT/IPN)
 
2 - Should I calculate discounts or will paypal do it
(using the NVP)
 
3 - Should I calculate shipping or will paypal do it
(using the NVP)
 
4 - Should I calculate taxes or will paypal do it
(using the NVP)
 
5 - What is the order of execution to calculate discounts?
For example.... Is this right?
If CartDiscountAmount > 0 Then
calculate discount based on fixed discount amount
ElseIf CartDiscountRate > 0 Then
calculate discount based on fixed discount rate
Else
calculate discount based on item discount settings
End If
 
6 - What is the order of execution to calculate shipping?
For example.... Is this right?
If CartShippingAmount > 0 Then
calculate shipping based on fixed shipping amount
ElseIf CartShippingRate > 0 Then
calculate shipping based on fixed shipping rate
Else
calculate shipping based on item shipping settings
End If
 
7 - What is the order of execution to calculate taxes?
For example.... Is this right?
If CartTaxAmount > 0 Then
calculate taxes based on fixed tax amount
ElseIf CartTaxRate > 0 Then
calculate taxes based on fixed tax rate
Else
calculate taxes based on item tax settings
End If
 
I have other questions too, but thought i would start at the beginning and ask the other questions as i go along.
 
I'm not asking for code samples.
I'm asking for pointers to go in the right direction.
Please dont refer me to the paypal website via links.
 

Thank You.
 

 
Well, after having enough of trawling the Paypal documentation I decided to write to their support department, upon completing and submitting my query, I was presented with a popup and links to some other documentation which looked a lot cleaner and more targetted at what I wanted.
 
So I wrote the function below to update my cart to the paypal processing server.
 
Please would someone be kind enough to look at it and point out any errors? and also i'm not sure how to process the options field? Any advice or help there would be greatly appreciated.
 
'-------------------------------------------------------------------------------------------------------------------------------------------------------------
'-> [Structure] Individual Item Options Collection Option Item - Suboption Item
'-------------------------------------------------------------------------------------------------------------------------------------------------------------
Structure _IntSuboptionItem
		Dim _OptionSelect AsString'option_selectX
Dim _OptionAmount AsLong'option_amountX
EndStructure'-------------------------------------------------------------------------------------------------------------------------------------------------------------
'-> [Structure] Individual Item Options Collection - Option Item
'-------------------------------------------------------------------------------------------------------------------------------------------------------------
Structure _IntOption
		Dim _Name AsString'Payapal OnX
Dim _Selection AsString'Paypal OsX
Dim _OptionIndex AsInteger'Paypal option_index (column which has prices)
Dim _Suboptions As Generic.List(Of _IntSuboptionItem)											'see _IntSuboptionItem
EndStructure'-------------------------------------------------------------------------------------------------------------------------------------------------------------
'-> [Structure] Individual Item Options Collection 
'-------------------------------------------------------------------------------------------------------------------------------------------------------------
Structure _IntOptions
		Dim _Options As Generic.List(Of _IntOption)
	EndStructure'-------------------------------------------------------------------------------------------------------------------------------------------------------------
'-> [Structure] Individual Item Params
'-------------------------------------------------------------------------------------------------------------------------------------------------------------
Structure _IntShoppingCartItem
		Dim _AmountX AsLong'amount 
Dim _BlocksX AsInteger'blocks (qty months)
Dim _DiscountAmountX AsLong'discount_amount 
Dim _DiscountAmount2X AsLong'discount_amount 2
Dim _DiscountRateX AsLong'discount_rate 
Dim _DiscountRate2X AsLong'discount_rate 2
Dim _DiscountNumX AsInteger'discount_num 
Dim _ItemNameX AsString'item_name 
Dim _ItemNumberX AsString'item_nunmber
Dim _QuantityX AsInteger'quantity
Dim _ShippingX AsLong'shipping
Dim _Shipping2X AsInteger'shipping2
Dim _TaxX AsLong'tax
Dim _TaxRateX AsInteger'tax_rate
Dim _UndefinedQuantitXy AsChar'undefined_quantity 
Dim _WeightX AsInteger'weight
Dim _WeightUnitX AsString'weight_unit
Dim _OptionFieldsX As _IntOptions																					'see _IntOptions
EndStructure'-------------------------------------------------------------------------------------------------------------------------------------------------------------
'-> [Structure] Shopping Cart Params
'-------------------------------------------------------------------------------------------------------------------------------------------------------------
Structure _IntShoppingCart
		Dim _Add AsString'add										add item to cart contents
Dim _Display AsString'display								display cart contents
Dim _Upload AsString'upload									upload cart contents (for payment)
Dim _Business AsString'business								the payto email email
Dim _DiscAmountCart AsLong'discount_amount_cart
Dim _DiscRateCart AsInteger'discount-rate_cart
Dim _HandlingCart AsLong'handling_cart
Dim _PaymentAction AsString'payment_action
Dim _ShoppingUrl AsString'shopping_url
Dim _Items As Generic.List(Of _IntShoppingCartItem)
	EndStructure 

 
	'-------------------------------------------------------------------------------------------------------------------------------------------------------------
'-> [Function] Upload Cart
'-------------------------------------------------------------------------------------------------------------------------------------------------------------
Function UploadCart(oCart As _IntShoppingCart, strShoppingUrl AsString) AsBoolean'Dim strReq AsString = NothingDim intItmIdx AsInteger = NothingDim intCounta AsInteger = NothingDim intCountb AsInteger = NothingDim intCountc AsInteger = Nothing''-> Initialise
		UploadCart = False'-> Validate
If Trim(oCart._Business) <> ""ThenIf ObtainEndpointUrl("nvpapi", "sandbox", "nvp", strReq) Then'core
				strReq = strReq & "?cmd=_cart"
				strReq = strReq & "&upload=1"
				strReq = strReq & "&business="& Trim(oCart._Business)
				strReq = strReq & "&paymentaction=sale"'urls
				strReq = strReq & "&shoppingurl="& strShoppingUrl
				'basket
If oCart._Items.Count > 0ThenFor intCounta = 0To oCart._Items.Count - 1
						intItmIdx = intCounta + 1'item-basics
						strReq = strReq & "&item_name_"& intItmIdx & "="& Trim(oCart._Items(intCounta)._ItemNameX)
						strReq = strReq & "&item_number_"& intItmIdx & "="& Trim(oCart._Items(intCounta)._ItemNameX)
						If oCart._Items(intCounta)._QuantityX > 0Then
							strReq = strReq & "&quantity_"& intItmIdx & "="& Trim(oCart._Items(intCounta)._QuantityX)
						Else
							strReq = strReq & "&undefinedquantity=1"EndIfIf oCart._Items(intCounta)._BlocksX > 0Then
							strReq = strReq & "&amount_"& intItmIdx & "="& FormatBlockPrice(oCart._Items(intCounta)._BlocksX, oCart._Items(intCounta)._QuantityX, oCart._Items(intCounta)._AmountX)
						Else
							strReq = strReq & "&amount_"& intItmIdx & "="& FormatBlockPrice(0, oCart._Items(intCounta)._QuantityX, oCart._Items(intCounta)._AmountX)
						EndIf'discounts
If oCart._DiscAmountCart > 0Then
							strReq = strReq & "&discount_amount_cart="& FormatPrice(oCart._DiscAmountCart)
						ElseIf oCart._DiscRateCart > 0Then
							strReq = strReq & "&discount_rate_cart="& FormatPrice(oCart._DiscRateCart)
						ElseIf oCart._Items(intCounta)._DiscountAmountX > 0Then
								strReq = strReq & "&discount_amount_"& intItmIdx & "="& FormatPrice(oCart._Items(intCounta)._DiscountAmountX)
								If oCart._Items(intCounta)._DiscountAmount2X > 0Then strReq = strReq & "&discount_amount2_"& intItmIdx & "="& FormatPrice(oCart._Items(intCounta)._DiscountAmount2X)
							EndIfIf oCart._Items(intCounta)._DiscountRateX > 0Then
								strReq = strReq & "&discount_rate_"& intItmIdx & "="& FormatPrice(oCart._Items(intCounta)._DiscountRateX)
								If oCart._Items(intCounta)._DiscountRate2X > 0Then strReq = strReq & "&discount_rate2_"& intItmIdx & "="& FormatPrice(oCart._Items(intCounta)._DiscountRate2X)
							EndIfIf oCart._Items(intCounta)._DiscountAmount2X > 0Or oCart._Items(intCounta)._DiscountRate2X > 0Then strReq = strReq & "&discount_num_"& intItmIdx & "="& FormatPrice(oCart._Items(intCounta)._DiscountNumX)
						EndIf'shipping
If oCart._HandlingCart > 0Then
							strReq = strReq & "&handling_cart="& FormatPrice(oCart._HandlingCart)
						ElseIf oCart._Items(intCounta)._ShippingX > 0Then
								strReq = strReq & "&shipping_"& intItmIdx & "="& FormatPrice(oCart._Items(intCounta)._ShippingX)
								If oCart._Items(intCounta)._Shipping2X > 0Then strReq = strReq & "&shipping2_"& intItmIdx & "="& FormatPrice(oCart._Items(intCounta)._Shipping2X)
							EndIfEndIf'tax
If oCart._Items(intCounta)._TaxX > 0Then
							strReq = strReq & "&tax_"& intItmIdx & "="& FormatPrice(oCart._Items(intCounta)._TaxX)
						ElseIf oCart._Items(intCounta)._TaxRateX > 0Then
							strReq = strReq & "&tax_rate_"& intItmIdx & "="& FormatBlockPrice(oCart._Items(intCounta)._BlocksX, oCart._Items(intCounta)._QuantityX, oCart._Items(intCounta)._TaxRateX)
						EndIf'metrics
If oCart._Items(intCounta)._WeightX > 0Then
							strReq = strReq & "&weight_"& intItmIdx & "="& FormatPrice(oCart._Items(intCounta)._WeightX)
							If Trim(LCase(oCart._Items(intCounta)._WeightUnitX)) = "kgs"Then
								strReq = strReq & "&weight_unit_"& intItmIdx & "=kgs"Else
								strReq = strReq & "&weight_unit_"& intItmIdx & "=lbs"EndIfEndIf'options
If oCart._Items(intCounta)._OptionFieldsX._Options.Count > 0ThenFor intCountb = 0To oCart._Items(intCounta)._OptionFieldsX._Options.Count - 1
								strReq = strReq & "&on"& intCounta & "_"& intCountb & "="& Trim(oCart._Items(intCounta)._OptionFieldsX._Options(intCountb)._Name)
								For intCountc = 0To oCart._Items(intCounta)._OptionFieldsX._Options(intCountb)._Suboptions.Count - 1'option_select?
'option_amount?
NextNextEndIfNextEndIfElse'error - failed to obtain endpointurl
EndIfElse'error - business name missing
EndIf
		intCounta = Nothing
		intCountb = Nothing
		intCountc = Nothing
		intItmIdx = Nothing
		strReq = Nothing'EndFunction'-------------------------------------------------------------------------------------------------------------------------------------------------------------
'-> [Function] FormatBlockPrice
'-------------------------------------------------------------------------------------------------------------------------------------------------------------
PrivateFunction FormatBlockPrice(intBlocks AsInteger, intQuantity AsInteger, lngValue AsLong) AsString'		FormatBlockPrice = "0.00"If intBlocks > 0ThenIf intQuantity > 1Then
				FormatBlockPrice = FormatPrice((intQuantity * lngValue) * intBlocks)
			ElseIf intQuantity = 1Then
				FormatBlockPrice = FormatPrice(lngValue * intBlocks)
			EndIfElseIf intQuantity > 1Then
				FormatBlockPrice = FormatPrice(intQuantity * lngValue)
			ElseIf intQuantity = 1Then
				FormatBlockPrice = FormatPrice(lngValue)
			EndIfEndIf'EndFunction'-------------------------------------------------------------------------------------------------------------------------------------------------------------
'-> [Function] FormatPrice
'-------------------------------------------------------------------------------------------------------------------------------------------------------------
PrivateFunction FormatPrice(lngValue AsLong) AsString'		FormatPrice = "0.00"If lngValue > 0Then FormatPrice = FormatNumber(lngValue, 2, TriState.True)
		'EndFunction'-------------------------------------------------------------------------------------------------------------------------------------------------------------
'-> [Function] EndpointUrl
'-------------------------------------------------------------------------------------------------------------------------------------------------------------
PrivateFunction ObtainEndpointUrl(strAuthentication AsString, strEnvironment AsString, strFormat AsString, ByRef strRtnEndpoint AsString) AsBoolean''-> Endpoint Definitions (DefaultAuthentication=Signature/DefaultEnvironment=Sandbox/DefaultFormat=NVP)
'Environment		Authentication											Calling								Endpoint
'Live						API Certificate											SOAP									https://api.paypal.com/2.0/
'Live						API Certificate											Name-Value Pair				https://api.paypal.com/nvp
'Sandbox				API Certificate											SOAP									https://api.sandbox.paypal.com/2.0/
'Sandbox				API Certificate											Name-Value Pair				https://api.sandbox.paypal.com/nvp
'Live						Adaptive APIs												JSON, NVP, XML				https://svcs.paypal.com/AdaptivePayments/API_operation
'Sandbox				Adaptive APIs												JSON, NVP, XML				https://svcs.sandbox.paypal.com/AdaptivePayments/API_operation 
'Live						Permissions Service APIs						JSON, NVP, SOAP				https://svcs.paypal.com/Permission/API_operation
'Sandbox				Permissions Service APIs						JSON, NVP, SOAP  			https://svcs.sandbox.paypal.com/Permission/API_operation
'Live						API Signature												SOAP									https://api-3t.paypal.com/2.0/
'Live						API Signature												Name-Value Pair				https://api-3t.paypal.com/nvp
'Sandbox				API Signature												SOAP									https://api-3t.sandbox.paypal.com/2.0/
'Sandbox				API Signature												Name-Value Pair				https://api-3t.sandbox.paypal.com/nvp
'		strRtnEndpoint = ""
		ObtainEndpointUrl = FalseSelectCase strAuthentication
			Case"apicertificate"If strEnvironment = "live"ThenIf strFormat = "soap"Then
						strRtnEndpoint = "https://api.paypal.com/2.0/"Else
						strRtnEndpoint = "https://api.paypal.com/nvp"EndIfElseIf strFormat = "soap"Then
						strRtnEndpoint = "https://api.sandbox.paypal.com/2.0/"Else
						strRtnEndpoint = "https://api.sandbox.paypal.com/nvp"EndIfEndIfCase"adaptiveapis"If strEnvironment = "live"Then
					strRtnEndpoint = "https://svcs.paypal.com/AdaptivePayments/API_operation"Else
					strRtnEndpoint = "https://svcs.sandbox.paypal.com/AdaptivePayments/API_operation"EndIfCase"permissionsapis"If strEnvironment = "live"Then
					strRtnEndpoint = "https://svcs.paypal.com/Permission/API_operation"Else
					strRtnEndpoint = "https://svcs.sandbox.paypal.com/Permission/API_operation"EndIfCaseElseIf strEnvironment = "live"ThenIf strFormat = "soap"Then
						strRtnEndpoint = "https://api-3t.paypal.com/2.0/"Else
						strRtnEndpoint = "https://api-3t.paypal.com/nvp"EndIfElseIf strFormat = "soap"Then
						strRtnEndpoint = "https://api-3t.sandbox.paypal.com/2.0/"Else
						strRtnEndpoint = "https://api-3t.sandbox.paypal.com/nvp"EndIfEndIfEndSelect
		ObtainEndpointUrl = (Trim(strRtnEndpoint) <> "")
		'EndFunction'-------------------------------------------------------------------------------------------------------------------------------------------------------------

I'm find C# asp.net linkedin sample code

$
0
0
hello
I'm looking for C# asp.net sample project
Donot this example recommend tome,because does not working
https://developer.linkedin.com/thread/1230?start=0&tstart=0
thank you

Should i change my asked question?

(This webpage has a redirect loop) Problem

$
0
0
Hi,
 
Why I am getting the above error with this code?
 
protectedvoid btnSend_Click(object sender, EventArgs e)
{
    if (txtMessage.Text == "")
    {
        Session["message_title"] = "Error";
        Session["message_title_Color"] = Color.Red.ToArgb();
        Session["message_text"] = "Please enter your message.";
        Session["message_button_title"] = "Back";
        Session["message_button_url"] = Request.UrlReferrer.ToString();
    }
 
    create_support_ticket create_support_ticket = new create_support_ticket();
    create_support_ticket.add_support_ticket(txtSubject.Text, txtEmailAddress.Text, txtMessage.XHTML);
}
 
and this is the add_support_ticket:
 
publicvoid add_support_ticket(string support_incident_title, string email_address, string support_ticket_description)
{
    support_sql_connection = new MySqlConnection(ConfigurationManager.ConnectionStrings["SQLdb"].ConnectionString);
    support_sql_connection.Open();
    support_sql_command = new MySqlCommand("sp_add_support_ticket", support_sql_connection);
    support_sql_command.CommandType = CommandType.StoredProcedure;
 
    support_sql_command.Parameters.Add("param_support_incident_title", MySqlDbType.VarChar).Value = support_incident_title;
    support_sql_command.Parameters.Add("param_email_address", MySqlDbType.VarChar).Value = email_address;
    support_sql_command.Parameters.Add("param_support_ticket_description", MySqlDbType.Text).Value = support_ticket_description;
 
    int result_rows = support_sql_command.ExecuteNonQuery();
 
    support_sql_command.Dispose();
    support_sql_connection.Close();
 
    HttpContext.Current.Session["message_title"] = "Thank you";
    HttpContext.Current.Session["message_title_Color"] = Color.Blue.ToArgb();
    HttpContext.Current.Session["message_text"] = "We have recieved your feedback and we will get back to you as soon as possible.";
    HttpContext.Current.Session["message_button_title"] = "Back";
    HttpContext.Current.Session["message_button_url"] = "Home.aspx";
 
    HttpContext.Current.Response.Redirect("Message.aspx");
}

why it's adding this to the database?!!

$
0
0
I have the following class code to add support ticket:
 
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using MySql.Data;
using MySql.Data.MySqlClient;
using System.Configuration;
using System.Globalization;
using Microsoft.Win32;
using System.Diagnostics;
using System.Reflection;
using System.IO;
using System.Security.Cryptography;
using DevExpress.Web.ASPxUploadControl;
using System.Drawing;
using System.Net;
using System.Net.Mail;
using System.Text;
 
namespace volow
{
    publicclass create_support_ticket
    {
        MySqlConnection support_sql_connection = null;
        MySqlCommand support_sql_command = null;
        // MySqlDataAdapter event_log_sql_adapter;
// DataTable data_table = null;
// MySqlDataReader event_log_sql_reader = null;
// MySqlDataReader sql_block_reader = null;
// DataSet event_log_data_set = null;
publicvoid add_support_ticket(string support_incident_title, string email_address, string support_ticket_description)
        {
            support_sql_connection = new MySqlConnection(ConfigurationManager.ConnectionStrings["SQLdb"].ConnectionString);
            support_sql_connection.Open();
            support_sql_command = new MySqlCommand("sp_add_support_ticket", support_sql_connection);
            support_sql_command.CommandType = CommandType.StoredProcedure;
 
            support_sql_command.Parameters.Add("param_support_incident_title", MySqlDbType.VarChar).Value = support_incident_title;
            support_sql_command.Parameters.Add("param_email_address", MySqlDbType.VarChar).Value = email_address;
            support_sql_command.Parameters.Add("param_support_ticket_description", MySqlDbType.Text).Value = support_ticket_description;
 
            int result_rows = support_sql_command.ExecuteNonQuery();
 
            support_sql_command.Dispose();
            support_sql_connection.Close();
 
            HttpContext.Current.Session["message_title"] = "Thank you";
            HttpContext.Current.Session["message_title_Color"] = Color.Blue.ToArgb();
            HttpContext.Current.Session["message_text"] = "We have recieved your feedback and we will get back to you as soon as possible.";
            HttpContext.Current.Session["message_button_title"] = "Back";
            HttpContext.Current.Session["message_button_url"] = "Home.aspx";
 
            if (!HttpContext.Current.Request.Path.EndsWith("Message.aspx", StringComparison.InvariantCultureIgnoreCase))
                HttpContext.Current.Response.Redirect("Message.aspx");
 
            // HttpContext.Current.Response.Redirect("Message.aspx");
        }
    }
}
 
and I am calling it from the webform like this:
 
protectedvoid btnSend_Click(object sender, EventArgs e)
{
    if (txtMessage.Text == "")
    {
        Session["message_title"] = "Error";
        Session["message_title_Color"] = Color.Red.ToArgb();
        Session["message_text"] = "Please enter your message.";
        Session["message_button_title"] = "Back";
        Session["message_button_url"] = Request.UrlReferrer.ToString();
    }
 
    create_support_ticket create_support_ticket = new create_support_ticket();
    create_support_ticket.add_support_ticket(txtSubject.Text, txtEmailAddress.Text, txtMessage.XHTML);
}
 
but I am getting two rows added for every insert! Thsi first row is correct as per the passed information but the second row adding the Session["message_title"] as support_incdent_title and the Session["message_text"] as support_ticket_description and I really don't know how??
 
here is my stored procedure:
 
INSERTINTO support_incidents (support_incident_title, email_address) VALUES (param_support_incident_title, param_email_address);
INSERTINTO support_tickets (support_incident_id, support_ticket_description) VALUES (LAST_INSERT_ID(), param_support_ticket_description);
Viewing all 3938 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>