Bharath Radhekrishna

Archive for the ‘ASP.NET,C#’ Category

Disabling some of the Textboxes in gridview edit

Posted by: onetidbit on: May 4, 2009

Situation: You need some text boxes disable when gridview is in edit mode.
=======
Solution:
======
1) Bind the Data without Sqldatasource Control
2) In Row Editing write the code:
protected void GridView1_RowEditing(object sender, GridViewEditEventArgs e)
{
GridView1.EditIndex = e.NewEditIndex;
[...]

Sometimes we will get the situation where we must insert NULL into datetime column in sql server.
Follow these steps to do that:
1) First Include the namespace:
using System.Data.SqlTypes;
2)  Declare
System.Data.SqlTypes.SqlDateTime getDate;
getDate = SqlDateTime.Null;
3) Insert using command Parameters
cmd11.Parameters.AddWithValue(“@encashed_date”, getDate);
——————————<>—————————————

How to Print a Gridview in ASP.NET 2.0

Posted by: onetidbit on: February 24, 2009

“””””””””””””””””””””””””””””””
<script language=”javascript” type=”text/javascript”>
function getconfirm()
{
return confirm(‘Are you sure you want to change the Folio No?’);
}
function Button1_onclick() {
//open new window set the height and width =0,set windows position at bottom
var a = window.open (”,”, ‘ left = ‘ + screen.width + ‘,top=’ + screen.height + ‘,width=0,height=0,toolbar=0,scrollbars=0,status=0′);
//write gridview data into newly open window
//major change here get innerHTML Of [...]

Tags:

Using Free Text Box in ASP.NET displaying HTML formatted text

Posted by: onetidbit on: January 9, 2009

Why do we must use FreeTextBox (FTB) control?

This will be useful when we want to display text with HTML formatting with label control.
when you enter the text in FTB it will saves with all the HTML tags in the table.
while displaying the label control along with browser renders HTML.
Before you start with this control you [...]

Random number generation in ASP.NET

Posted by: onetidbit on: August 6, 2008

Random number generation in ASP.NET
ఏదో ఒక్క నెంబర్ జనరేషన్ in ASP.NET
Step 1:
write a class file.
eg:
Create a cs file named as rand.cs
using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using Microsoft.VisualBasic;
/// <summary>
/// Summary description for random_number
/// </summary>
public class random_number
{
public string GetRandomNumber(int length, string characterSet)
{
string randomData = “”;
int position = 0;
byte[] data = new byte[length];
int characterSetLength = [...]

ASP.NET Tutorials

Posted by: onetidbit on: August 5, 2008

ASP.NET లో బేసిక్స్ కావాలంటే చూడండి
http://quickstarts.asp.net/QuickStartv20/aspnet/Default.aspx
చాలా బాగా అర్ధమయ్యిది.

ఫొప్ అప్ బాక్స్ ముసివెసినా తర్వతా పరెంట్ పెజ్ రిఫ్రెష్ అవుతుంది
in popup.aspx write down the following line
Response.Write(“<script>window.opener.location=’sample.aspx’;window.close();</script>”)
this will close popup after clicking save button of popup and refresh the parent form.
భరత్ రాధే కృష్ణ

Generating serial numbers in Data controls

Posted by: onetidbit on: August 4, 2008

If you want to generate serial number column in data controls just see below:
Gridview: Container.DataItemIndex+1
(For e.g. In gridview
<asp:TemplateField HeaderText=”S.No”>
<ItemTemplate><%#Container.DataItemIndex+1 %></ItemTemplate>
</asp:TemplateField>
)
Datalist:  Container.ItemIndex+1
Formview: Container.PageIndex+1