Archive

Posts Tagged ‘ASP.NET’

AngularJS Form Validation – Disable Submit / Confirm Password Custom Directive

January 21, 2016 Leave a comment

http://jsfiddle.net/rahuladmin/9ew85Lp3/

Hope this help !

Bootstrap and datepicker

November 17, 2015 Leave a comment

How to Access Parent Page (.aspx) control (IDs) from its child User Control (.ascx)

November 5, 2015 Leave a comment

Write below line of code in control to find relevant parent page (aspx page)’s control

Code for VB.NET

Dim MainContent As ContentPlaceHolder = Me.Page.Master.FindControl(“MainContent”)

Dim btnPrint As Button = MainContent.FindControl(“btnPrint”)

 

Hope this help !

 

 

Page Life Cycle


Page Life Cycle

 

Seq Events Controls Initialized View state
Available
Form data
Available
What Logic can be written here?
1 Init No No No Note: You can access form data etc. by using ASP.NET request objects but not by Server controls.Creating controls dynamically, in case you have controls to be created on runtime. Any settinginitialization.Master pages and them settings. In this section, we do not have access to viewstate , posted values and neither the controls are initialized.
2 Load view state Not guaranteed Yes Not guaranteed You can access view state and any synch logic where you want viewstate to be pushed to behind code variables can be done here.
3 PostBackdata Not guaranteed Yes Yes You can access form data. Any logic where you want the form data to be pushed to behind code variables can be done here.
4 Load Yes Yes Yes This is the place where you will put any logic you want to operate on the controls. Like flourishing a combobox from the database, sorting data on a grid, etc. In this event, we get access to all controls, viewstate and their posted values.
5 Validate Yes Yes Yes If your page has validators or you want to execute validation for your page, this is the right place to the same.
6 Event Yes Yes Yes If this is a post back by a button click or a dropdown change, then the relative events will be fired. Any kind of logic which is related to that event can be executed here.
7 Pre-render Yes Yes Yes If you want to make final changes to the UI objects like changing tree structure or property values, before these controls are saved in to view state.
8 Save view state Yes Yes Yes Once all changes to server controls are done, this event can be an opportunity to save control data in to view state.
9 Render Yes Yes Yes If you want to add some custom HTML to the output this is the place you can.
10 Unload Yes Yes Yes Any kind of clean up you would like to do here.

 

Reference :

http://www.codeproject.com/Articles/73728/ASP-NET-Application-and-Page-Life-Cycle

 

Categories: ASP.NET Tags: ,

File Download code in vb.net


If Not String.IsNullOrEmpty(strURL) Then
Dim req As New WebClient()
Dim response As HttpResponse = HttpContext.Current.Response
response.Clear()
response.ClearContent()
response.ClearHeaders()
response.Buffer = True
response.AddHeader(“Content-Disposition”, “attachment;filename=””” + Server.MapPath(strURL) + “”””)
Dim data As Byte() = req.DownloadData(Server.MapPath(strURL))
response.BinaryWrite(data)
response.[End]()
End If

 

Hope it helps !

SalesForce (Login) Integration With ASP.NET

April 24, 2015 1 comment

Steps…

  1. Add Service Reference, select Advanced and then select Add Web Reference.
  2. In the URL box of the Add Web Reference dialog box, type the URL to obtain the service description of the XML Web service you want to access, such as:

    c:\Files\enterprise.wsdl

  3. Click Go to retrieve information about the XML Web service.
  4. In the Web reference name box, rename the Web reference to sforce, which is the name you will use for this Web reference.
  5. Click Add Reference to add a Web reference for the target XML Web service.
  6. Visual Studio retrieves the service description and generates a proxy class to interface between your application and the XML Web service.

Issues :

error CS0030: Cannot convert type ‘SFDC.ListViewRecordColumn[]’ to ‘SFDC.ListViewRecordColumn’
error CS0030: Cannot convert type ‘SFDC.ListViewRecordColumn[]’ to ‘SFDC.ListViewRecordColumn’
error CS0029: Cannot implicitly convert type ‘SFDC.ListViewRecordColumn’ to ‘SFDC.ListViewRecordColumn[]’
error CS0029: Cannot implicitly convert type ‘SFDC.ListViewRecordColumn’ to ‘SFDC.ListViewRecordColumn[]’

Solution:

Add following to enterprise.wsdl.xml

<xsd:attribute name=”tmp” type=”xsd:string”></xsd:attribute>

e.g.

<complexType name=”ListViewRecord”>
<sequence>
<element name=”columns” type=”tns:ListViewRecordColumn” maxOccurs=”unbounded”/>
</sequence>
<xsd:attribute name=”tmp” type=”xsd:string”></xsd:attribute>
</complexType>

Hope this help!