Saturday 25 May 2013


Introduction:-


                 in this Example we Explain that How to Insert Update Image in MVC in asp.net in grid view.
 
Description:-


                We can Edit the Image same as we done in C#.Net but Here we have to manage each code in Diiferant File.Look at the Following Code in which we can Bind the Image in Gridview usind asp code in Html Design Form.

For Ex:-
                <input type="file" name="file" id="file" /> <%
                Response.Write("<img src='../../Content/"+Model.photo+"' alt='ii'
width='80' height='80' />");
 
             %>

  Look at the above Example we Fetch the Image path like (Model.photo)  From  the database and Displa are Displaying it Using Create a <img> tag with src Element and displaying Image at runtime. So it is very difficult task then as simple display in gridview in asp.net with c#.


Look also <%=Html.ActionLink("Back to List", "Index") %>   this will Automatically Create a Link to the HomePage.




Look the Following code for Fetch Image FileName



QuestionModelDataContext qDB = new QuestionModelDataContext();

                        var m = qDB.demoimages.First(p => p.id == id);

                        m.name = collection["name"].ToString();
                        m.photo = posted.FileName;



to show Example of Insert,Update,Delete in MOdalPopup ModalPopup for CRUD operation

  how to Generate Random or Unique password Auto Generate Unique Password

Export Gridview data to PDF file Export Gridview Row to PDF

how to Edit,Update Image in GridView in MVC4 In asp.net


Introduction:-


                 in this Example we Explain that How to Insert Update Image in MVC in asp.net in grid view.
 
Description:-


                We can Edit the Image same as we done in C#.Net but Here we have to manage each code in Diiferant File.Look at the Following Code in which we can Bind the Image in Gridview usind asp code in Html Design Form.

For Ex:-
                <input type="file" name="file" id="file" /> <%
                Response.Write("<img src='../../Content/"+Model.photo+"' alt='ii'
width='80' height='80' />");
 
             %>

  Look at the above Example we Fetch the Image path like (Model.photo)  From  the database and Displa are Displaying it Using Create a <img> tag with src Element and displaying Image at runtime. So it is very difficult task then as simple display in gridview in asp.net with c#.


Look also <%=Html.ActionLink("Back to List", "Index") %>   this will Automatically Create a Link to the HomePage.




Look the Following code for Fetch Image FileName



QuestionModelDataContext qDB = new QuestionModelDataContext();

                        var m = qDB.demoimages.First(p => p.id == id);

                        m.name = collection["name"].ToString();
                        m.photo = posted.FileName;



to show Example of Insert,Update,Delete in MOdalPopup ModalPopup for CRUD operation

  how to Generate Random or Unique password Auto Generate Unique Password

Export Gridview data to PDF file Export Gridview Row to PDF
This entry was posted in :
Introduction:-

              in this Example we Expalin How to Bind Image in Gridview in Mvc4 in Asp.net with Insert update Delete Facility.


Description:-

                We can Bind the Image same as we done in C#.Net but Here we have to manage each code in Diiferant File.Look at the Following Code in which we can Bind the Image in Gridview usind asp code in Html Design Form.
For Ex:-
                <% foreach (var item in Model) {  %>
  
        <tr>
            <td>
                <%= Html.ActionLink("Edit", "Edit", new { id=item.id }) %> |
                <%= Html.ActionLink("Details", "Details", new { id=item.id })%>
            </td>
            <td>
                <%= Html.Encode(item.id) %>
            </td>
            <td>
                <%= Html.Encode(item.name) %>
            </td>
            <td>
            <%
                Response.Write("<img src='../../Content/"+item.photo+"' alt='ii' width='80' height='80' />");
             %>
      
            </td>
        </tr>
  
    <% } %>
  

Look at the above Examle through Freach Loop We can Bind All Record and each Record was Define with a  Edit <%= Html.ActionLink("Edit", "Edit", new { id=item.id }) %> | and Details  <%= Html.ActionLink("Details", "Details", new { id=item.id })%>
Link in Gridview Format.

  we Fetch the Image and Bind this Image in GridView by using this Code like
<td>
            <%
                Response.Write("<img src='../../Content/"+item.photo+"' alt='ii' width='80' height='80' />");
             %>
      
            </td>

Look also <%= Html.ActionLink("Create New", "Create") %> this will Automatically Create a Link For Add New Record.

Insert,Update,Delete in MOdalPopup in MVC4 CRUD operation in Popup in MVC

change the Background color of selected Gridview Row Change color based on checkbox selection

Autocomplete TextBox Search Example Autocomplete in Ajax

How to Bind Image in Gridview in MVC4 in asp.net

Introduction:-

              in this Example we Expalin How to Bind Image in Gridview in Mvc4 in Asp.net with Insert update Delete Facility.


Description:-

                We can Bind the Image same as we done in C#.Net but Here we have to manage each code in Diiferant File.Look at the Following Code in which we can Bind the Image in Gridview usind asp code in Html Design Form.
For Ex:-
                <% foreach (var item in Model) {  %>
  
        <tr>
            <td>
                <%= Html.ActionLink("Edit", "Edit", new { id=item.id }) %> |
                <%= Html.ActionLink("Details", "Details", new { id=item.id })%>
            </td>
            <td>
                <%= Html.Encode(item.id) %>
            </td>
            <td>
                <%= Html.Encode(item.name) %>
            </td>
            <td>
            <%
                Response.Write("<img src='../../Content/"+item.photo+"' alt='ii' width='80' height='80' />");
             %>
      
            </td>
        </tr>
  
    <% } %>
  

Look at the above Examle through Freach Loop We can Bind All Record and each Record was Define with a  Edit <%= Html.ActionLink("Edit", "Edit", new { id=item.id }) %> | and Details  <%= Html.ActionLink("Details", "Details", new { id=item.id })%>
Link in Gridview Format.

  we Fetch the Image and Bind this Image in GridView by using this Code like
<td>
            <%
                Response.Write("<img src='../../Content/"+item.photo+"' alt='ii' width='80' height='80' />");
             %>
      
            </td>

Look also <%= Html.ActionLink("Create New", "Create") %> this will Automatically Create a Link For Add New Record.

Insert,Update,Delete in MOdalPopup in MVC4 CRUD operation in Popup in MVC

change the Background color of selected Gridview Row Change color based on checkbox selection

Autocomplete TextBox Search Example Autocomplete in Ajax

This entry was posted in :

Friday 24 May 2013



Description:-

 In this Example we explain that How to store Image in database using “Image data type  or  how we can store image in the database. the main need to store image in database occur, while there is a issue of security. I mean to says that we can store the image of the signature of the people or human, because of the banking security or any other Department. To store the image in the database we have to use byte[] array. First when upload image by user using file upload control then I will convert the image into byte array[] and then it will store the image in the database..This type of example is very useful when we want to directally add the Image in Byte[] Format not the path of image in database.

       in which we can easily upload any type of Image like .jpg,.png,.jpeg etc... and easily Retrieve from the Database and Display it. 

Here is a code to Convert image into byte[] before we uploading it to the Database are as follow

byte[] imageByte = new byte[flUpload.PostedFile.InputStream.Length + 1];

        flUpload.PostedFile.InputStream.Read(imageByte, 0, imageByte.Length);

        _sqlCommand.Parameters.AddWithValue("Image", imageByte);

When we Retrieve Image From database we have First Type cat like

//we need to typecast to byte[] before feeding it to BinaryWrite method.

        if (_sqlDataReader.Read())

        {

            Response.BinaryWrite((byte[])_sqlDataReader["photo"]);

        }

the main Advantages of this example is the image is stored in database so you have not to maintain it's path. and the Disadvantage is that you have to Required High Database Size Because wall Image is stored in the database.

To Show Example of How to Upload File in MVC Application then click here upload Image and bind to Gridview in MVC

How to Handle Concurrency in Linq to Sql Concurrency Handle in Linq to SQL

Generate Random Password Autogenerate Unique Password

How to Upload Image in asp.net having dataType in database is Image.



Description:-

 In this Example we explain that How to store Image in database using “Image data type  or  how we can store image in the database. the main need to store image in database occur, while there is a issue of security. I mean to says that we can store the image of the signature of the people or human, because of the banking security or any other Department. To store the image in the database we have to use byte[] array. First when upload image by user using file upload control then I will convert the image into byte array[] and then it will store the image in the database..This type of example is very useful when we want to directally add the Image in Byte[] Format not the path of image in database.

       in which we can easily upload any type of Image like .jpg,.png,.jpeg etc... and easily Retrieve from the Database and Display it. 

Here is a code to Convert image into byte[] before we uploading it to the Database are as follow

byte[] imageByte = new byte[flUpload.PostedFile.InputStream.Length + 1];

        flUpload.PostedFile.InputStream.Read(imageByte, 0, imageByte.Length);

        _sqlCommand.Parameters.AddWithValue("Image", imageByte);

When we Retrieve Image From database we have First Type cat like

//we need to typecast to byte[] before feeding it to BinaryWrite method.

        if (_sqlDataReader.Read())

        {

            Response.BinaryWrite((byte[])_sqlDataReader["photo"]);

        }

the main Advantages of this example is the image is stored in database so you have not to maintain it's path. and the Disadvantage is that you have to Required High Database Size Because wall Image is stored in the database.

To Show Example of How to Upload File in MVC Application then click here upload Image and bind to Gridview in MVC

How to Handle Concurrency in Linq to Sql Concurrency Handle in Linq to SQL

Generate Random Password Autogenerate Unique Password


Description:-

                    In this Example we explain that how we can convert byte[] to image and image to byte[].
there is a sitution when this example is very useful.

  For Example:-

                  when you have to generate a report from gridview and in gridview there is a image of each student when user click on each row of grid the name name of image are displayed in report but image are not displayed for this reason to display student image in report you have to first convert byte[] to image and then bind to the report.


in which we Define two Function one for Covert ByteArray to Image and second is Image to ByteArray. when you Call this Function  First it will Check the Image Extention if it return True the it Will convert otherwise it will Return False.this Function will Read File and Open it and Convert it to the ByteArray. To Covert ByteArray to Image the FileStream Class is used to Return Image. and when Convert From Image to ByteArray BinaryWrite Class is used to Return ByteArray. look as Example


FileStream fs = new FileStream(p_postedImageFileName, FileMode.Open, FileAccess.Read);





BinaryReader br = new BinaryReader(fs);

byte[] image = br.ReadBytes((int)fs.Length);

Before using this Example you have to Add NameSpace 


using System.IO;


How to Handle Concurrency in Linq to Sql Handle Concurrency in Linq to Sql

Read/Write Text File in Asp.Net with C# Example of Read/Write File

Validation For Enter only Ahphabet in TextBox Javascript Validation For only allows Ahphabets

How to Convert Byte Array to Image and Image To Byte Array in asp.net


Description:-

                    In this Example we explain that how we can convert byte[] to image and image to byte[].
there is a sitution when this example is very useful.

  For Example:-

                  when you have to generate a report from gridview and in gridview there is a image of each student when user click on each row of grid the name name of image are displayed in report but image are not displayed for this reason to display student image in report you have to first convert byte[] to image and then bind to the report.


in which we Define two Function one for Covert ByteArray to Image and second is Image to ByteArray. when you Call this Function  First it will Check the Image Extention if it return True the it Will convert otherwise it will Return False.this Function will Read File and Open it and Convert it to the ByteArray. To Covert ByteArray to Image the FileStream Class is used to Return Image. and when Convert From Image to ByteArray BinaryWrite Class is used to Return ByteArray. look as Example


FileStream fs = new FileStream(p_postedImageFileName, FileMode.Open, FileAccess.Read);





BinaryReader br = new BinaryReader(fs);

byte[] image = br.ReadBytes((int)fs.Length);

Before using this Example you have to Add NameSpace 


using System.IO;


How to Handle Concurrency in Linq to Sql Handle Concurrency in Linq to Sql

Read/Write Text File in Asp.Net with C# Example of Read/Write File

Validation For Enter only Ahphabet in TextBox Javascript Validation For only allows Ahphabets



Description:-

 In this Example,we can Create code through which we can display the detail of each record in javascript popup. For Ex:-when user move the mouse in gridview the detal of each record are display in javascript popup.suppose user move mouse on first row the first row description will be display in popup if user move mouse on second row the second row detail is displayed and so on.

           The Image are display above,Look at carefully when user move mouse on Third Record the Third Record Detail are Display in popup are shown in above Image with Red BackGround.

          In Which Example we Create a we Add Attribute to Each DataRow in the RowDtaBound Event like

            if (e.Row.RowType == DataControlRowType.DataRow)
     {

            e.Row.Attributes.Add("onclick", ClientScript.GetPostBackClientHyperlink(this.GridView1, "Select$" + e.Row.RowIndex));
        }
 

          using this type of facility you can improve your website and that is very useful to when record is very long so at that time the in Gridview only main Field is Displayed so for that reason you can easily display other background detail of each record in a javascript popup very clearly. otherwise you have to create a nested gridview to show the background detail of each record. 


to show the example of Nested Gridview click here   NestedGridviewExample


to show Example of how to Redirect to another aspx page in javascript click here Redirect to another aspx page in javascript

to show example of how to create timer or display clock in javascript click here create timer or display clock in javascript

to show example of how to display current time in webpage click here Display current time in webpage

How to Display Gridview Row Detail in javascript Popup When Mouse is Moved in Each Row of Gridview in Asp.net




Description:-

 In this Example,we can Create code through which we can display the detail of each record in javascript popup. For Ex:-when user move the mouse in gridview the detal of each record are display in javascript popup.suppose user move mouse on first row the first row description will be display in popup if user move mouse on second row the second row detail is displayed and so on.

           The Image are display above,Look at carefully when user move mouse on Third Record the Third Record Detail are Display in popup are shown in above Image with Red BackGround.

          In Which Example we Create a we Add Attribute to Each DataRow in the RowDtaBound Event like

            if (e.Row.RowType == DataControlRowType.DataRow)
     {

            e.Row.Attributes.Add("onclick", ClientScript.GetPostBackClientHyperlink(this.GridView1, "Select$" + e.Row.RowIndex));
        }
 

          using this type of facility you can improve your website and that is very useful to when record is very long so at that time the in Gridview only main Field is Displayed so for that reason you can easily display other background detail of each record in a javascript popup very clearly. otherwise you have to create a nested gridview to show the background detail of each record. 


to show the example of Nested Gridview click here   NestedGridviewExample


to show Example of how to Redirect to another aspx page in javascript click here Redirect to another aspx page in javascript

to show example of how to create timer or display clock in javascript click here create timer or display clock in javascript

to show example of how to display current time in webpage click here Display current time in webpage

Introduction:-


                  in this example we explain that how to create auto complete search in asp.net.



Description:-


         Using AutoCompleteExtender you can attach to any TextBox with minimum character. In TextBox when User Types Prefix Text then it will call the webservices and that Webservice will Return the List that are Display as Popup Below the the TextBox.

Description of the property of the AutocompleteExtender Control:-

TargetControlID - The TextBox control in which the user types content to be automatically auto completed.

EnableCaching- Caching is turned on, so typing the same prefix multiple times results in only one call to the web service. It is true or false.

MinimumPrefixLength- Minimum number of characters that user must have to entered before getting suggestions from the web service.

CompletionInterval - Time in milliseconds when the timer will call Tick in to get suggestions using the web service.

CompletionSetCount - Number of suggestions will be retrieved from the web service.

 


To show Example of Popup in Ajax click Here Modal Popup in Ajax with Asp.Net

to Show example of Nested Popup Click Here Nested Modal Popup in Ajax with Asp.Net

to show Example of AutoComplete TextBox Extender click Here AutoComplete Extender in Ajax with Asp.Net

to show Example of Password Strength Extender click Here Password Strength in Ajax with Asp.Net

Example Of AutoCompleteExtender Control in ajax in asp.net


Introduction:-


                  in this example we explain that how to create auto complete search in asp.net.



Description:-


         Using AutoCompleteExtender you can attach to any TextBox with minimum character. In TextBox when User Types Prefix Text then it will call the webservices and that Webservice will Return the List that are Display as Popup Below the the TextBox.

Description of the property of the AutocompleteExtender Control:-

TargetControlID - The TextBox control in which the user types content to be automatically auto completed.

EnableCaching- Caching is turned on, so typing the same prefix multiple times results in only one call to the web service. It is true or false.

MinimumPrefixLength- Minimum number of characters that user must have to entered before getting suggestions from the web service.

CompletionInterval - Time in milliseconds when the timer will call Tick in to get suggestions using the web service.

CompletionSetCount - Number of suggestions will be retrieved from the web service.

 


To show Example of Popup in Ajax click Here Modal Popup in Ajax with Asp.Net

to Show example of Nested Popup Click Here Nested Modal Popup in Ajax with Asp.Net

to show Example of AutoComplete TextBox Extender click Here AutoComplete Extender in Ajax with Asp.Net

to show Example of Password Strength Extender click Here Password Strength in Ajax with Asp.Net

Introduction:-


                  In this Example we explain that How to use modalpopup in our WebApplication are Described Here.


Description:-


                        The ModalPopupExtender allows Users to Display Content of Element into the Popup. When Popup is Show at that popup is Display with HighLight and User are not allowed to do any other operation even the click on the other Control are not permitted.

You can provide OnShowing/OnHiding/OnHidden animations which are played when the modalPopupExtender  content is shown and hidden.


Property of the ModalPopupExtender:-
  TargetControlID - The ID of the  activates the modal popup.
  PopupControlID - The ID of the element to display as a modal popup like Button etc….
  BackgroundCssClass - The CSS class for Popup to apply to the background when the modal popup is displayed.
  DropShadow - True to automatically add a dropshadow to the modal popup.
  OkControlID - The ID of the element that dismisses the modal popup.
  OnOkScript - The script to run when the modal popup is dismissed using the element specified in OkControlID.
  CancelControlID - The ID of the Control that cancels the modal popup
  OnCancelScript - Script to run when the modal popup is dismissed with the CancelControlID
  PopupDragHandleControlID - The ID of the embedded element that contains the popup header/title which will be used as a drag handle
  X - The X coordinate of the top/left corner of the modal popup (the popup will be centered horizontally if not specified)
  Y - The Y coordinate of the top/left corner of the modal popup (the popup will be centered vertically if not specified)
  RepositionMode - The setting that determines if the popup needs to be repositioned when the window is resized or scrolled.


Methods
  • initialize() - Initializes the ModalPopupExtender behavior.
  • dipose() – Disposes or End the ModalPopupExtender behavior.
  • show() - Displays the element that is referenced by the PopupControlID property as a modalpopup dialog box.
  • disableTab() - Changes the tab indexes so that tabbing moves the focus only through the modal dialog box.
    • Remarks - In Internet Explorer 6, the disableTab method also hides the select elements.
  • restoreTab() - Restores the tab indexes from the page.
    • Remarks - In Internet Explorer 6, the restoreTab method also restores the select elements.
  • hide() - Hides the modal popup.
    • Returns - Returns a Boolean value that specifies whether the popup was hidden.


How to Send SMS to user in asp.net Send SMS to users mobile

Rotate the Ads or Advertisement in webpage Rotate Ads without refreshing the page

to show Example of Password Strength Extender click Here Password Strength in Ajax with Asp.Net

how to create modalpopup and display popup in Detailview in asp.net

Introduction:-


                  In this Example we explain that How to use modalpopup in our WebApplication are Described Here.


Description:-


                        The ModalPopupExtender allows Users to Display Content of Element into the Popup. When Popup is Show at that popup is Display with HighLight and User are not allowed to do any other operation even the click on the other Control are not permitted.

You can provide OnShowing/OnHiding/OnHidden animations which are played when the modalPopupExtender  content is shown and hidden.


Property of the ModalPopupExtender:-
  TargetControlID - The ID of the  activates the modal popup.
  PopupControlID - The ID of the element to display as a modal popup like Button etc….
  BackgroundCssClass - The CSS class for Popup to apply to the background when the modal popup is displayed.
  DropShadow - True to automatically add a dropshadow to the modal popup.
  OkControlID - The ID of the element that dismisses the modal popup.
  OnOkScript - The script to run when the modal popup is dismissed using the element specified in OkControlID.
  CancelControlID - The ID of the Control that cancels the modal popup
  OnCancelScript - Script to run when the modal popup is dismissed with the CancelControlID
  PopupDragHandleControlID - The ID of the embedded element that contains the popup header/title which will be used as a drag handle
  X - The X coordinate of the top/left corner of the modal popup (the popup will be centered horizontally if not specified)
  Y - The Y coordinate of the top/left corner of the modal popup (the popup will be centered vertically if not specified)
  RepositionMode - The setting that determines if the popup needs to be repositioned when the window is resized or scrolled.


Methods
  • initialize() - Initializes the ModalPopupExtender behavior.
  • dipose() – Disposes or End the ModalPopupExtender behavior.
  • show() - Displays the element that is referenced by the PopupControlID property as a modalpopup dialog box.
  • disableTab() - Changes the tab indexes so that tabbing moves the focus only through the modal dialog box.
    • Remarks - In Internet Explorer 6, the disableTab method also hides the select elements.
  • restoreTab() - Restores the tab indexes from the page.
    • Remarks - In Internet Explorer 6, the restoreTab method also restores the select elements.
  • hide() - Hides the modal popup.
    • Returns - Returns a Boolean value that specifies whether the popup was hidden.


How to Send SMS to user in asp.net Send SMS to users mobile

Rotate the Ads or Advertisement in webpage Rotate Ads without refreshing the page

to show Example of Password Strength Extender click Here Password Strength in Ajax with Asp.Net