|
Pleasure having your words , Now its working well even on Opera.
Thanks
Navneet Hegde
Nashik
Develop2Program & Program2Develop
|
|
|
|
|
Hi all,
i need to invoke a function, when the user clicks the left button of the mouse, inside a textbox. i am using asp.net 2.0 with c#.
can anybody help me.
Thanks in advance
Sebastian
|
|
|
|
|
hi,
It is possible to track click event of textbox in javascript.
but in C# textbox doesnt have click event. So you can not create eventhandler for that.
Thanks and Regards,
Chetan Ranpariya
|
|
|
|
|
Ok. i can use vb also. can you say how to implement this.
Many Thanks for reply
sebastian
|
|
|
|
|
Hi,
R u Developing webapplication or windowsapplication?
Thanks and Regards,
Chetan Ranpariya
|
|
|
|
|
its a webapplication
thanks
sebastian
|
|
|
|
|
why do you want to handle click on textbox?
<< >>
|
|
|
|
|
i need to dispaly some thing in text box when user clicks in the textbox.
thanks
sebastian
|
|
|
|
|
ohh...for this...just use onfocus js event to handle this...
<< >>
|
|
|
|
|
i tried it out just now, but didn't got any results.
do you have any code snippet to help me?.
thanks
sebastian
|
|
|
|
|
|
|
Hi Everybody,
Sorry for the very basic question, I'm totally new to ASP.NET. My task is to write a simple user control to be talking with SharePoint. The problem I have is understanding communication with the Datagrid. At hte moment where I think I must be geeting the contents of the cells on grid I'm getting Argument.Out.OfRAnge Exception. I'm obviously doing something wrong, but my Win-form experience doesn't tell me what. Any help is very much appreciated. Thanks
In the following code I'm able to display the contents of the DataTable, then add a new row to the table, display it. But when I click on the "update" button on the grid to display the contents of the cells in Labels, "Index Out of range"exception is thrown.
Code:
private void Page_Load(object sender, System.EventArgs e)
{
if(!Page.IsPostBack)
{
Fill();
Bind();
}
}
#region Bind
private void Fill()
{
fieldList = new ArrayList();
fieldList.Add("Field1");
fieldList.Add("Field2");
missGridTable = new DataTable();
string error = string.Empty;
SPCom sp = new SPCom();
missGridTable = sp.BindWithFieldList(web,"Test List",fieldList,error); //this succesfully populates the datatable
}
private void Bind()
{
missionGrid.DataSource = missGridTable;
missionGrid.AutoGenerateColumns=false;
missionGrid.DataBind();
foreach(DataColumn c in missGridTable.Columns)
{
missionGrid.Columns.Add(CreateBoundColumn(c));
}
missionGrid.DataBind();
}
private BoundColumn CreateBoundColumn(DataColumn c)
{
BoundColumn column = new BoundColumn();
column.DataField = c.ColumnName;
column.HeaderText = c.ColumnName.Replace("_"," ");
column.DataFormatString ="";
return column;
}
#endregion Bind
private void InsertEmpty()
{
missGridTable.Rows.InsertAt(missGridTable.NewRow(), 0);
}
private void add_Click(object sender, System.EventArgs e)
{
try
{ // inserting
missionGrid.EditItemIndex = 0;
// modify text
EditCommandColumn ecc =
(EditCommandColumn) missionGrid.Columns[0];
ecc.UpdateText = "Insert";
// fill table, insert empty row, bind to datagrid
Fill();
InsertEmpty();
Bind();
}
catch (Exception Ex)
{
Label1.Text = Ex.ToString();
}
}
# region grid click parser
private void grid_ItemCommand(object source,
System.Web.UI.WebControls.DataGridCommandEventArgs e)
{
// stop editing
missionGrid.EditItemIndex = -1;
switch (e.CommandName)
{
case "Update": // this causes an exception
{
try
{
TableCell cellField1 = e.Item.Cells[1];
TableCell cellField2 = e.Item.Cells[2];
string field1 = cellField1.Text;
string field2 = cellField2.Text;
Label1.Text = "-----" + field2;
Label1.Text = "asasdsadasd";
}
catch (Exception ex)
{
Label1.Text = ex.ToString();
}
|
|
|
|
|
HI,
Exactly where you get the error?
Thanks and Regards,
Chetan Ranpariya
|
|
|
|
|
Hi,
I'm getting an error here, when I'm trying to access the fields in the DataGrid
The exception is index out of range
try
{
TableCell cellField1 = e.Item.Cells[1];
TableCell cellField2 = e.Item.Cells[2];
string field1 = cellField1.Text;
string field2 = cellField2.Text;
Label1.Text = "-----" + field2;
}
thanks
-- modified at 6:55 Monday 7th May, 2007
|
|
|
|
|
Hi,
The solution I m giving you is as per my consideration because I am not aware of the term "SPCom" in your code.
As per your code your datatable is having only 2 columns "Field1" and "Field2". So the datagrid will have only 2 columns [0] and [1] when u bind it with the table.
In try block you are trying to access cell[2] which is actually 3rd column of the datagrid which does not exist. I think this is why you r getting this exception.
If I m correct then the solution is to have proper number of columns in your grid so that u can access them in your code.
I hope this will help you.
Thanks and Regards,
Chetan Ranpariya
|
|
|
|
|
Hello,
Is there a way we can make a Cross Tab in GridView using ASP.NET 2.0.
There is a simple workarund available that the SQL statement can be restructred so that it returns cross tab view however this is not something which I want.
Thanks
|
|
|
|
|
with the below code the program runs without any error. still no mails are received at the client side.
my code is as follows:
----------------------
using System.Net.Mail;
protected void btnSendMail_Click(object sender, EventArgs e)
{
SmtpClient mysmtpClient = new SmtpClient();
mysmtpClient.Host = "localhost";
mysmtpClient.UseDefaultCredentials = true;
MailMessage jum = new MailMessage();
MailAddress mfrom = new MailAddress("me@myweb.com", "me");
mysmtpClient.Port = 25;
jum.From = mfrom;
jum.To.Add("client1@myweb.com");
jum.To.Add("client2@myweb.com.com");
jum.Subject = "subject and object";
jum.Body = "hello fellow what r u doing";
jum.IsBodyHtml = false;
mysmtpClient.Send(jum);
Label1.Text = "mail sent successfully";
}
vlm
|
|
|
|
|
use the namespace System.Web.Mail and try ......
MailMessage mail=new MailMessage();
mail.To = "rahul@microsoft.com";//to address
mail.From = "xxx@xx.com"; //give any address
mail.Subject = "Issue Fixed"; //Subject of mail
mail.Body = "The issue has been fixed"; //Body of mail
SmtpMail.SmtpServer = "10.54.1.1";//Use this if u use proxy server for internet
SmtpMail.Send(mail);
|
|
|
|
|
hi,
im using asp.net2.0. i want to print the contents of a datagrid. is there any in built techniques.
I am usnig paging but need the entire data of the datagrid
thanks in advance
arun
|
|
|
|
|
|
hi,
thank u for ur help...it describes how to do it in a desktop application, im seeking help in the case of the asp.net
arun
|
|
|
|
|
Please guide me how use if condition in datagrid templates.
I have table in data is of threetype
status is field heading name.
status
Inkitchen
Ready
Serve
i want to show data in datagrid templete in different color in one coloum
like this
Inkitchen should be in red color
Ready should be in ble color
serve should be in black color
i using lable or link button
suhail shahab
|
|
|
|
|
Hi,
If you r using labels to display the status then you can check for the Text Property of them in the ItemDataBound event of the datagrid and change to color of lable there.
The following code may help you.
protected void dg_ItemDataBound(object sender, DatagridItemEventArgs e)
{
if(e.Item.ItemTyep == ListItemType.Item || e.Item.ItemType.AlternateItem)
{
Label lbl = (Label)(e.Item.FindControl("lblStatus");
if(lbl.Text == "Inkitchen")
lbl.ForeColor = Color.Red;
else if(lbl.Text == "Ready")
lbl.ForeColor = Color.Blue;
else if(lbl.Text == "Serve")
lbl.ForeColor = Color.Black;
}
}
Thanks and Regards,
Chetan Ranpariya
|
|
|
|
|
salam sir
I am vvvvvery happy of ur guidance and sending code.u have solved my problem thanks sir.
Sohial shahab
|
|
|
|