Loading ...

Who is online?  0 guests and 1 members
home  »  blogs  »  Vinay Gupta

Communifire Blogs

Vinay Gupta : Most Recent postings

Vinay Gupta

Gridview row edit, delete, update and paging

9/6/2010 by Vinay Gupta · 13 · 18162

Today I would like to share gridview edit, update and delete a row. Following I have described the some gridview event and how to handle this event. Edit: protected void GridView1_RowEditing(object sender, GridViewEditEventArgs e) { GridView1.EditIndex = e.NewEditIndex; // fetch and rebind the data. GridBind(); } Cancel edit: protected void GridView1_RowCancelingEdit(object sender, GridV...

Vinay Gupta

How to populate dropdownlist through jquery

9/3/2010 by Vinay Gupta · 9 · 23415

First of all some basic operations that might you need to do when you play with dropdown. 1. Add an option to list: $("<option value='0'>Select</option>").appendTo("#ddlCategory"); 2. Remove all the Options from drop down: $("#ddlCategory> option").remove(); 3. Get the selected item Text: $("#ddlCategory option:selected").text(); 4. Get the selected item Value: $("#ddlCate...

Vinay Gupta

Find list of triggers in SQl Server

8/19/2010 by Vinay Gupta · 0 · 2254

Today I need to make changes in trigger but I forgot the name of trigger and associated table with it. So quickly find out the list of triggers associated with the tables in a database, I used following query. USE [YourDatabaseName] SELECT [Name] AS TriggerList, OBJECT_NAME(parent_id) AS TableList, create_date AS CreatedDate, modify_date AS ModifiedDate FROM sys.triggers ORDER BY [Name] ...

Vinay Gupta

How to implement modal popup in datalist repeater

6/18/2010 by Vinay Gupta · 4 · 11366

Here I discuss that how to implement modal popup in different data control like datalist and repeater. To show the modalpopup in datalist/repeater we have to use the item command event of respective control. Data control: <asp:DataList ID="dlst" runat="server" DataKeyField="ID" OnItemCommand="dlst_ItemCommand" > <HeaderTemplate> </HeaderTemplate> <ItemTemplate> &l...

Vinay Gupta

How to find which control caused postback

5/20/2010 by Vinay Gupta · 0 · 2722

To find that which control caused postback, the following example might help you. I am giving example on page load event when postback takes place. protected void Page_Load(object sender, EventArgs e) { //on every postback you can print the ID of the control which caused postback if (IsPostBack) { Control ctl = GetPostBackControl(Page); if (ctl != null) Response.Write(ctl.ID); } } //meth...

Vinay Gupta

SET ENABLE BROKER in SQL Server 2005

7/7/2009 by Vinay Gupta · 2 · 5800

SQL Server got hanged when we try the enable service broker. So to get rid of this you have to follow these steps: First of all kill all the connections. After that changed DB mode into single user ALTER DATABASE database_name SET SINGLE_USER 3. Enable the broker ALTER DATABASE database_name SET ENABLE_BROKER 4. Finally set DB mode to multi user ALTER DATABASE database_name SET MULTI_USE...

Vinay Gupta

How to make default submit button for Enter key in asp.net

4/17/2009 by Vinay Gupta · 1 · 7572

To make the default submit button for enter key, we have to use the default key property of Form tag or panel control. I have given the example that describe how to implement it in different scope depends on your actual need. Here goes some code snippet <form id="form1" runat="server" defaultbuton="btnSubmit"> <asp:Button ID="btnSubmit" runat="server"/> </form> <asp:...

Vinay Gupta

System.ArgumentException: Invalid postback or callback argument

3/17/2009 by Vinay Gupta · 1 · 7852

This exception generally comes when you have bind the datalist/drop down(or some other datacontrol like gridview,repeater etc.) at page load. When you click on button of datalist or drop down selected index is fire then every time your datalist/drop down populated. Because when an event raise(by the selected index change/buton click) a postback happen and page load call. So to avoid this...

Vinay Gupta

Modal pop up with in update panel

2/23/2009 by Vinay Gupta · 5 · 15488

I have faced a abnormal behaviour of modal pop up when used it with update panel. I have used five modal up in a single page and show modal popup in different condition. (not on a click of button) So I used a common dummy button which is visible false.(because we cannt leave the TargetControlID of popup extender.) Its working fine untill I havent enclosed with in update panel. But when I...

Vinay Gupta

How to implement autoextender for autosuggest textbox

2/10/2009 by Vinay Gupta · 2 · 10968

I have seen that lot of my friends having problem in implementing the autoextender. so that i have tried to describe that how to implement it.it may make easier to implement autoextender. Step1:Add required controls Add a text box from your toolbox. Add a autoextender and set the TargetControlID of it by setting the id of above textbox.for eg. <asp:TextBox ID="txtname" runat="server"/...

Vinay Gupta

How to manipulate the string in C#

2/7/2009 by Vinay Gupta · 0 · 4384

Before start the string manipulation.first of all we take a review of String class in c#. System.String class String class is a sealed class and defined as "sequential collection of System.Char objects." string vs String string is used to represent text and it is sequential collection unicode characters. String is used to represent string and it is sequential collection of System.Char ob...

Vinay Gupta

How can get the system date and system time (separately)

1/27/2009 by Vinay Gupta · 0 · 7479

Here I discuss the different formats of datetime. most of us facing this format relating issues during work with datetime. so these format may help u to display the date time format as we want . and it also help to reduce chances of exception. To get the system date and time separately in c# .just use the for date only: DateTime.Now.ToShortDateString(); for timeonly: DateTime.Now.ToShort...

Vinay Gupta

Add web reference in console application while web reference option is missing

1/20/2009 by Vinay Gupta · 6 · 14928

A Service Reference is the same as a Web Reference. that is, you can add an ASMX web service as a reference and it will generate your proxies/etc. just like Add Web Reference did. 1) Right click References and click 'Add Service Reference' 2) In the Add Service Reference dialog click Advanced 3) In the Advanced Dialog click 'Add Web Reference' 4) Continue as you normally would for an asm...

Vinay Gupta

Credit card validation through regular expression validator in asp.net

1/14/2009 by Vinay Gupta · 4 · 16367

Couple of month ago I had worked on e-commerce site, where I have to validate the credit card number. I have described some dummy credit card number by which you can test . 1. Master Card : 5431-1111-1111-1111 master card have 16 numbers starting with 5. 2.Visa : 4111-1111-1111-1111 or 4111-1111-1111-1 Visa have 13 or 16 numbers starting with 4 3: American Express : 341-1111-1111-1111 or...

Vinay Gupta

TinyMCE validation problem in ASP.Net

1/9/2009 by Vinay Gupta · 2 · 9761

I have used a Tinymce editor on a page and placed a required field validator to validate textarea. When I click the button at first time, it was gives a validaion error message even field was not empty, but at second time it submitted succesfully. Then I was tried some code which has solved my issue. The following describes how to use a validator along side TinyMCE to validate the conten...

Vinay Gupta

How to call javascript when used update panel

1/9/2009 by Vinay Gupta · 0 · 13920

Today, I would like to share that how to call a javascript code at aspx.cs side when we use updatepanel. Because when we used the update panel then asynchronous request goes to server. So that we have to register the script to the script manager and then it works perfectly. Please note that we have to register with scriptmanager not with scriptmanager1 or something else. Eg. protected vo...

Vinay Gupta

Email Sending through ASP.NET

1/5/2009 by Vinay Gupta · 2 · 1371

How to send the email through asp.net is very usefull in every web application.so that i want to give some code by which you are easily send mail. Email sending through asp.net is described below: public void sendMail(string email, string name, string Password) { try { string from = " xyz@abc.com "; string MailTo = email; string title = "Email title"; string sBody = "Dear <b>" + na...

Vinay Gupta

Image And File Uploading Using ASP.NET

1/5/2009 by Vinay Gupta · 0 · 10936

I want to share that, How to upload a file or an image through asp.net. First of you have to take a file upload control for browsing the file and button for uploading it at specified location. <asp:FileUpload ID="image_upload" runat="server" /> <asp:Button ID="btnUpload" runat="server" Text="Upload" OnClick="btnUpload_Click" /> after that you have write following functions fo...

Vinay Gupta

Passing multiple command arguments on a button click in a Repeater

1/2/2009 by Vinay Gupta · 6 · 22513

Today I have learnt one thing that will help you too. so that I want to share this to you as usual. So my task is to delete the row from repeater on the basis of two parameters ASPX Page : <asp:Button ID="button1 Text="Accept" CommandName="Accept" CommandArgument = '<%# Eval("ID1") + "," + Eval("ID2") %>' runat="server" /> ASPX.CS : protected void rpt1_ItemCommand(object sour...

Vinay Gupta

Passing multiple query string params from datalist hyperlink column

12/31/2008 by Vinay Gupta · 0 · 4347

I have faced problem while passing the multiple querysring parameters from the hyperlink column of datalist.I have spend time for this and ultimately I have found right one. So i would like describe that how it can possible: <asp:DataList ID="dlst1" runat="server" > <ItemTemplate> <a Href='<%#"page1.aspx?first=" + Eval("First") + "& second=" + Eval("Second") %>' ...

Vinay Gupta

Common reasons of Object Reference not set to an instance of an object

12/30/2008 by Vinay Gupta · 0 · 4129

I have faced this exception several times and spent lot of time to solve this problem, Basically when I was beginner in progamming. I think this error comes in different conditions, but iwould like to discuss the common reasons which i have faced during my programming life. Scope Declaration: When we used a variable which scope defined locally and used like global.Suppose we define a var...

Vinay Gupta

Dynamic Search SQL Query

12/30/2008 by Vinay Gupta · 4 · 3287

Few days back I have faced problem regarding sending multiple value in single parameter (Like. 1,2,3..) to the stored procedure and on the basis of that, I have to use the result of this stored procedure. I have spend couple of days for solving this issue.so I want to share this to you. First of all I have taken a parameter of type string which contains the value like "1,2,3" .after that...

Page 1 of 1 (22 items)

Product Spotlight

ASP.NET Hosting Spotlight

Join CodeAsp.Net for FREE Today!

It's fast, easy and free! Submit articles, get your own blog, ask questions & give answers in the forums, and become a better developer, faster.

enter your email address:

 

Quick Vote

What kind of email newsletter would you prefer to receive from CodeAsp.Net?