Posts

Showing posts from 2013
How to replace <p> </p> in gridview rows in asp.net c# <asp:TemplateField HeaderText="Questions" SortExpression="TheQuestion"> <ItemTemplate> <asp:Label ID="lblQuestion" runat="server" Text='<%# Server.HtmlDecode(Eval("TheQuestion").ToString()) %>'></asp:Label> </ItemTemplate> <ItemStyle HorizontalAlign="Left" Width="100%" /> </asp:TemplateField>
Extract Only Numeric in C# string Retcode = Regex.Replace(Request.QueryString["code"].ToString(), "[^0-9]+", string.Empty);
Insert – save multiple checked checkbox values in SQL Server http://www.webtechminer.com/split-function-in-sql-server-to-break-comma-separated-string/
Gridview export to excel without having control like linkbutton, or anybutton(to hide columns) Frontend note: <%@ Page Title="" Language="C#" MasterPageFile="~/admin/admin.master" AutoEventWireup="true" CodeFile="CarMake.aspx.cs" Inherits="admin_CarMake" EnableEventValidation="false" %>     ----------------------------------------------------------------------------------------- Backend cs:- protected void btnExport_Click(object sender, EventArgs e) { ExporttoExcel(); } public override void VerifyRenderingInServerForm(Control control) { /* Verifies that the control is rendered */ } private void ExporttoExcel() { Response.Clear(); Response.AddHeader("content-disposition", "attachment;filename=ExistingCarData" + System.DateTime.Now.ToShortDateString() + ".xls"); Response.Charset = ""; Response.ContentType = "application/vnd.xls"; Str
update multiple columns into single or one columns in sql begin tran CREATE TABLE #TempAdd ( DealerId int, MainAddress varchar(1000) ) insert into #TempAdd SELECT DealerId , DealerName + '<br/>' + CASE          WHEN Address1 is null  THEN  ''          ELSE Address1 +' <br/>'       END  + CASE          WHEN Address2 is null  THEN  ''          ELSE Address2 +' <br/>'       END  +  CASE          WHEN Address3 is null  THEN  ''          ELSE Address3 +' <br/>'       END   +       CASE          WHEN Address is null  THEN  ''          ELSE Address +' <br/>'       END       + CASE          WHEN PINCode is null  THEN  ''          ELSE PINCode +' <br/>'       END        + CASE          WHEN StateName is null  THEN  ''          ELSE StateName +' <br/>'       END as MainAddress  from dealer UPDATE dealer SET dealer.MainAddress=#TempAdd.MainAddress FR
session in asp.net save at server side or client side :- The SessionID is generated Server Side, but is stored on the Client within a Cookie. Then everytime the client makes a request to the server the SessionID is used to authenticate the existing session for the client.
Image
Preview image file before upload to webserver   Ref: http://blog.raminassar.com/2011/07/05/preview-image-file-before-upload-to-webserver/#.UZcVs6JHLRJ     Muddsar Khan http://www.aspsnippets.com/Articles/Display-image-after-upload-without-page-refresh-or-postback-using-ASP.Net-AsyncFileUpload-Control.aspx     You can use javascript to preview the selected image before uploading it to the server. < html xmlns ="http://www.w3.org/1999/xhtml" > < head id ="Head1" runat ="server" > < title > Main Page </ title > < script type ="text/javascript" > function FileUpload1_onchange(oFileUpload1) { document.getElementById( 'Image1' ).src = oFileUpload1.value ; } </ script > </ head > < body > < form id ="form1" runat ="server" > < asp:FileUpload
Photoshop Tips: 1.To resize Image -->. ctrl + + -->. shift & Adjust through mosue -->. once adjust it press enter.
Language Translation Editor http://www.quillpad.in/editor.html
Code to add background color or background image:- Frontend:- <html> <head> <title></title> </head> <body id="bgBody" runat="server"> </body> </html> C# apply in any method:- // Background color code  bgBody.Attributes["bgcolor"] = "#cc0000"; //background image code bgBody.Attributes.Add("background", "images/fullbg.jpg");
Get IPAddress of PC in c#: HttpRequest currentRequest = HttpContext.Current.Request; string ipAddress = currentRequest.ServerVariables["HTTP_X_FORWARDED_FOR"]; if (ipAddress == null || ipAddress.ToLower() == "unknown") ipAddress = currentRequest.ServerVariables["REMOTE_ADDR"];
How to insert multiple rows from c# table to sql database table:- Frontend:   <asp:Button ID="Button2" runat="server" Text="Create Table"             onclick="Button2_Click" /> <asp:GridView ID="gveg" runat="server">         </asp:GridView> Backend C#:  protected void Button2_Click(object sender, EventArgs e)     {         //         // Here we create a DataTable with four columns.         //                 DataTable temptable = new DataTable();         temptable.Columns.Add("ProductID", typeof(string));         temptable.Columns.Add("RelatedProductID", typeof(string));         temptable.Columns.Add("IsActive", typeof(string));         foreach (ListItem item in ListBox1.Items)         {             if (item.Selected)             {                 //                 // Here we add five DataRows.                 //                 temptable.Rows.Add(1, 1, 1);             }
Text in Proper Case or say Title Case ;-  lnk_1.Text = CultureInfo.CurrentCulture.TextInfo.ToTitleCase("Find a goal");  //TextInfo UsaTextInfo = new CultureInfo("en-US", false).TextInfo; Ouput: Find A Goal
Comparing a value in between two columns I have a table TblControl. Data type of both field is int. StartRange End Range BMIClassification Table startval endvalue 0 100 200 300 500 600 900 950 SELECT StartRange, EndRange FROM Control WHERE 225 BETWEEN StartRange AND EndRange eg:- Declare @BMIValue int set @BMIValue=34 SELECT * FROM BMIClassification WHERE @BMIValue between startval and endvalue    
Cart URL http://demo.opencart.com/admin/index.php?route=catalog/product&token=e1ce5583d537727fce5af2d43e894c50   http://www.cs- cart .com/demo- item.html http://discover.store.sony. com/tablet/#specs/diagram   http://www.bit- cart .com/ shopping- cart -live-demo.html
collection list in c# http://www.dotnetperls.com/list
Multirow inserts INSERT INTO tablesname (col1,clo2) VALUES ( 'data1' , 'data2' ) , ( 'data3' , 'data4' ) ;  
insert, update ,delete multiple rows using c# and sql at once with the help of list and function  ANS. 1. Create function:- CREATE FUNCTION [dbo].[udf_CsvToInt] ( @Array VARCHAR(max) ) RETURNS @IntTable TABLE (IntValue INT) AS BEGIN IF @Array <> '' BEGIN DECLARE @separator char(1) SET @separator = ',' DECLARE @separator_position INT DECLARE @array_value VARCHAR(2000) SET @array = @array + ',' WHILE patindex('%,%' , @array) <> 0 BEGIN SELECT @separator_position = patindex('%,%' , @array) SELECT @array_value = LEFT(@array, @separator_position - 1) INSERT @IntTable Values (CAST(@array_value AS INT)) SELECT @array = stuff(@array, 1, @separator_position, '') END END RETURN end 2.update example ALTER PROC spUpdateTable @strID varchar(100) AS    UPDATE tablename     SET IsActive = 1     WHERE tableID in (select * from dbo.udf_CsvToInt(@strID) ) 3. C# button Click event   protected void btnTagIndexPage_Click(object sender, EventArgs e
Search table name used in stored procedures SELECT DISTINCT so.name, so.xtype FROM syscomments sc INNER JOIN sysobjects so ON sc.id=so.id WHERE sc.TEXT LIKE '%udf_CsvToInt%'
Get Question Paper Previous Years University Question Papers http://www.indiastudychannel.com/question-papers/
asp.net interview material http://soft-engineering.blogspot.in/p/aspnet.html http://www.a2zinterviews.com/DotNet/asp.net/ http://steptodotnet.blogspot.in/2012/07/dot-net-interview-questions-for-2.html http://www.aspdotnet-suresh.com/2010/05/interview-questions-in-aspnetcnetsql.html