ssreevidya.m Light Poster

Hai,
I used a table for generating grade for students. for thati used the fields:
UpperBound[int]
LowerBound[int]
Grade [varchar(50)]

I have some datas such as :

UpperBound LowerBound Grade
61 70 D
71 80 C
81 90 B

I sent the value 80.09 to Stored procedure.

Stored procedure something like this:
[CODE]select * from SCH_Grade_Master where SCH_Grade_Master.Lbound<=80.09 and SCH_Grade_Master.Ubound>=80.09
[/CODE]

But no result get for values like 80.09, 70.08 etc
but get results for 81.02 79.00 etc

Can u help me to solve this.

Thanks in advance,

Sreevidya

hai ,
I want to display only the pagesize-dropdown in the pager row without page index.
For that can I set the FirstPageText as empty. I tried like following, but it didnt work.
[CODE]Gridview1.PagerSettings.FirstPageText = "";[/CODE]

Thanks in advance,

Sreevidya.

ssreevidya.m Light Poster

hai
I have a grid that include paging and i created pagesize drop down for page sizing.
I use PreRender event for displaying this pagerrow even if the row count not exeeds the pagesize.
My problem is, in pager row the page index also dispalyed with page size dropdown as '1'.
Can i hide it or any other solution for this problem.

Thanks in Advance,
Sreevidya

ssreevidya.m Light Poster

hai,

I want an expression for all alphabets and some special characters like . - ' etc.
I use an expression like ^[-_'.,A-Za-z]* but it doesnt contain '. can i get a correct expression for this.

Thanks in advance

Sreevidya

ssreevidya.m Light Poster

Hi
I add an additional headerrow for pagesizing. The additional row is added on
GrdRemarkNature_RowCreated event.
Code I used is:
[CODE] GridViewRow row = new GridViewRow(0, -1, DataControlRowType.Header, DataControlRowState.Normal);
row.ID = RowId;

        Table t = (Table)GrdRemarkNature.Controls[0];
        TableCell cell = new TableHeaderCell();

        cell.ColumnSpan = 10; // ********
        Literal oLit = new Literal();
        oLit.Text = "Page Size: ";
        cell.Style["padding-left"] = "600px";
        cell.Controls.Add(new LiteralControl("Page Size:"));
        cell.Controls.Add(ddl);

        row.Cells.Add(cell);
        t.Rows.AddAt(0, row);[/CODE]

can i get this row after databind.

Thanks in advance,

Sreevidya

ssreevidya.m Light Poster

hi,
i want to create a custom gridview control with paging, sorting and filtering.
I tried a lot of for it , but didnt get it correctly.
Can you give me the code for it.

thanks in advance,

sreevidya

hai,
thank you for your replay.

but my problem is that the two events I described can call from a class to the aspx pages taht includes gridview. I could call the first event but couldnt second.

I did it like follows:
Class:
[CODE]public class GetGridEvent
{
public GetGridEvent()
{
//
// TODO: Add constructor logic here
//
}

public void GridRowCreatedEventHandler(Object src,GridViewRowEventArgs e)
{
    if (e.Row.RowType == DataControlRowType.Pager)
    {
        DropDownList ddl = new DropDownList();
        //adds variants of pager size
        ddl.Items.Add("5");
        ddl.Items.Add("10");
        ddl.Items.Add("15");
        ddl.AutoPostBack = true;
        Table pagerTable = e.Row.Cells[0].Controls[0] as Table;
        TableCell cell = new TableCell();
        cell.Style["padding-left"] = "15px";
        cell.Controls.Add(new LiteralControl("Page Size:"));
        cell.Controls.Add(ddl);
        pagerTable.Rows[0].Cells.Add(cell);
        ddl.SelectedIndexChanged += new EventHandler(ddl_SelectedIndexChanged);

    }
}

[/CODE]
calling event at aspx page:
[CODE]GetGridEvent grdEvnt = new GetGridEvent(); GrdStudentMarkList.RowCreated += new GridViewRowEventHandler(grdEvnt.GridRowCreatedEventHandler);[/CODE]

Like taht how can i manage the dropdown list selectedIndexChage evnet.

ssreevidya.m Light Poster

hai,

I used gridview pager for page sizing. But I have more than 15 web pages that are also needed page sizing. how can i create a class for this purpose and access it.

The code I used is:

[CODE] protected void GrdStudent_RowCreated(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.Pager)
{
DropDownList ddl = new DropDownList();
//adds variants of pager size
ddl.Items.Add("5");
ddl.Items.Add("10");
ddl.Items.Add("15");
ddl.AutoPostBack = true;
//selects item due to the GridView current page size
ListItem li = ddl.Items.FindByText(GrdStudent.PageSize.ToString());
if (li != null)
ddl.SelectedIndex = ddl.Items.IndexOf(li);
ddl.SelectedIndexChanged += new EventHandler(ddl_SelectedIndexChanged);

        //adds dropdownlist in the additional cell to the pager table
        Table pagerTable = e.Row.Cells[0].Controls[0] as Table;
        TableCell cell = new TableCell();
        cell.Style["padding-left"] = "15px";
        cell.Controls.Add(new LiteralControl("Page Size:"));
        cell.Controls.Add(ddl);
        pagerTable.Rows[0].Cells.Add(cell);
    }
}

void ddl_SelectedIndexChanged(object sender, EventArgs e)
{
//changes page size
GrdStudent.PageSize = int.Parse(((DropDownList)sender).SelectedValue);
//binds data source
DataTable ObjDt = ViewState["table"] as DataTable;
GrdStudent.DataSource = ObjDt;
GrdStudent.DataBind();
} [/CODE]

Thanks in advance,

sreevidya.

ssreevidya.m Light Poster

hi

how can i subtract a date from other.

I have a table 'tbl_Course'.

The table structure is:
1.Id int (set as primary key)

  1. Coursename nvarchar(50)

The table contents are:
id Coursename
1 MBA
2 MBA
3 MCA
4 BCA

Here Coursename 'MBA' is repeated.
Then I want to delete duplicate values from the table.
I hope you can help me.

Thanks in advance.

Hi,
Thank you for your replay. How can I write query for this.
Thanks in advance.

ssreevidya.m Light Poster

Hi,
I have a dropdown list in the headerrow of a gridview.
When submiting data to the database, how can i check the value is selected or not from the dropdown list using javascript.

Thanks in advance.

ssreevidya.m Light Poster

Hi,

How can I delete duplicate records from a table in a single query.
Thanks in advance.

Thank you for your answer.

But I couldn't get the concept relative or vortual path.Could you please describe it for me.

Thanks in advance.

ssreevidya.m Light Poster

hi,

what is the use of server.mappath().
what is the return value of this method.

Thanks in advance.

ssreevidya.m Light Poster

Hi,
I used the confirmation in a page when one of the ultrawebgridcell updated.I used the following code.
[code]
private void MessageBox(string msg)
{
Label lbl = new Label();
lbl.Text = "" + Environment.NewLine + "window.confirm('" + msg + "')";
Page.Controls.Add(lbl);
}
protected void uwgSelected_UpdateCell(object sender, CellEventArgs e)
{
MessageBox("Continue or Not");
empDtls.employeedetails(0, dEmpId, sName, sGender, dtDOB, 0, "", 0, 0, 0, 0, 0, 0, 0, iDesgnId, dtime, 0, ideptId, 0, 0, "", "", "", "", 0, "",0);
cvselected.fCVSelected(0, 0, iCVId, srefNo, 0, dtime, dtime, "", 0, dtime, "", "",dEmpId);
}[/code]
I want to gte the result of confirmation for further processing.
The codes after the Messagebox calling, executes only if the confirmation messga is true.
How can I implement it.
Thanks in advance.

Hi,
I tried this method.But the image stored as bits of zeros.
Is any another way to solve this problem.
Thanks in advance.

ssreevidya.m Light Poster

Hi, I have a need to insert images to the database.

I tried it using the following code:

[code]if ((file1.PostedFile != null) && (file1.PostedFile.ContentLength > 0))

{

// Get the filename.

byte[] fileData = null;

string fn = System.IO.Path.GetFileName(file1.PostedFile.FileName);

try

{

// Access the file stream and begin the upload. Store the file in a memory byte array.

Stream MyStream = file1.PostedFile.InputStream;

long iLength = MyStream.Length;

fileData = new byte[(int)MyStream.Length];

MyStream.Read(fileData, 0, (int)MyStream.Length);

MyStream.Close();

clsConns obj1=new clsConns();

obj1.insertProducts(txtPname.Text,txtCat.Text,int.Parse(txtQty.Text),int.Parse(txtPri.Text),fileData);

}

catch (Exception excep)

{

Response.Write(excep.ToString());

}

}[/code]

But some invalid byte values are stored on the database.

I used Visual studio2005 and sqlserver2000.

Can I get the correct method for inserting images to the database.

Thanks in advance.

Hi,

The button click event code is:

[code=asp.net]protected void imgSave_Click(object sender, ImageClickEventArgs e)
{
if (txtCountryid.Text != "")
{
int id = Convert.ToInt32(txtCountryid.Text.ToString());
string name = txtCountryName.Text;

        DataSet ds = new DataSet();
        ds = country.countnameProc(9, 0, name);
        DataTable dt = ds.Tables[0];
        if (dt.Rows.Count != 0)
        {
            MsgBox1.alert("Alredy Exist");
            txtCountryid.Text = "";
            txtCountryName.Text = "";
        }
        else
        {
            country.countnameProc(1, id, name);
            ffilllstSearch();
            //Response.Write(@"<script language='javascript'>alert('Item Saved')</script>");
            MsgBox1.alert("ItemSaved");
            txtCountryid.Text = "";
            txtCountryName.Text = "";
        }
                    }

    else
    {
        MsgBox1.alert("Add New Item");
    }
}[/code]

It works and 'Item saved' message displayed only after the Internet Explorer message displyed and click on 'No'.
Thanks in Advance.

Hi,
I remove the statement
[icode]MsgBox1.alert("ItemSaved");[/icode] from my code and replace it with

[icode]Response.Write(@"alert('Item Saved')");[/icode]
Even the same message displayed.

Hi,
I never used javascript code in my page.

this is the code in .aspx page:

[code]
[/code]

And I used the code in aspx.cs page is:

[code] int id = Convert.ToInt32(txtCountryid.Text.ToString());
string name = txtCountryName.Text;
country.countnameProc(1, id, name);
MsgBox1.alert("ItemSaved");
txtCountryid.Text = "";
txtCountryName.Text = "";[/code]

Thanks in advance.

ssreevidya.m Light Poster

Hi,

I have web page containing 4 ImageButtons for get new id,delete a record,edit the record and save a record.The three of them worked correctly.

But when clicking on the save button, a message of microsoft internet exolorer displayed like this:

The Web Page you are Viewing is trying to close the window.

Do you want to close the window?

If I click on 'No', the Save button Works its function. What is the reason for it?

How can i overcome this problem?

Hope you can help me.

Thanks in advance.

ssreevidya.m Light Poster

Hi,

I stored a file in the folder taht selected using file upload control.

When I tried to view this content from that folder I got an error like this.

Cannot find the C:\Documents and settings\Terapc\LocalSettings\temporary Internet Files\Content.IE5\6AJ9DNHZ\name.txt file

Do you want to create a new file?

The code I used to view this file is:

[code=asp.net]if (file.Exists)
{

Response.Clear();

Response.AddHeader("Content-Disposition", "attachment; filename=" + file.Name);
Response.AddHeader("Content-Length", file.Length.ToString());

Response.ContentType = "application/octet-stream";
Response.WriteFile(file.FullName);

Response.End();

}

else

{

MsgBox1.alert("The file does not exist");
}[/code]

Hope you can help me.

Thanks in advance.

ssreevidya.m Light Poster

I tried to run my project in local host after publishing it.
then i get the error like following:

Cannot convert type 'ASP.slogin_aspx' to 'System.Web.UI.WebControls.Login'
how can i solve it.And waht is the reason for this type of error.

Thanks in advance.