Wednesday, March 12, 2014

How to insert a stored procedure result into a table

INSERT INTO ExistedTableName
EXEC [dbo].[Storedprocedure]  @Param1


If we execute these statements the result of the stored procedure will be inserted into the table ExistedTableName.

Tuesday, March 11, 2014

Array.Indexof is used to find the occurence of an element in an Array

Array.IndexOf is used to find the occurence of an elment in an array. i.e it picks out the index where this element is appearing in the array.

Example :

var hobbies= ["Walking", "Shotting", "Riding", "Cricket"];
var a = fruits.indexOf("Cricket");


a holds the value of 3 . Because the index where Cricket present is 3.

How to make the text align to top left corner for a tag in aspx page

To make the test appears at corner we have to write like this :
<td  style="vertical-align:top;width:50%;height:50%">

otherwise it looks like :


















How to call server side function from aspx page and how to assign the image

In aspx page :
<asp:ImageButton ID="imgbtn"  runat="server"  ImageUrl='<%#GetImage(Eval("TemplateID")) %>'  CommandArgument='<%#Eval("TemplateID")%>' AlternateText="" />

In code behind :

protected string GetImage(object objGrid)
        {
            if ((int)(objGrid)==1)
            {
                return @"\images\ImgPPM.jpg";
            }
            else if ((int)(objGrid) == 2)
            {
                return @"\images\ImgBuild.jpg";
            }
            else if ((int)(objGrid) == 3)
            {
                return @"\images\ImgDelivery.jpg";
            }
            else
            {
                return objGrid.ToString();
            }
        }