|
I'm sorry, this question is incomprehensible. What I think you're trying to do, seems trivial, but without seeing your code, I don't see how anyone can offer specific advice.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
I have created my webapp in ASP.NET, C# and MS-Access.
in Table I have cell value as, 1 and 0. At the time of binding I want to convert it to On and Off respecively. How can I do it? Please help , as I am new to .NET
This is my code.
private void Binding()
{
// create the connection
OleDbConnection con = new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=F:/GmoteDeviceControl/App_Data/DeviceCtrl.mdb;User Id=admin;Password=;");
// Open the connection
con.Open();
// create the DataSet
DataSet ds = new DataSet();
// create the adapter and fill the DataSet
OleDbDataAdapter da = new OleDbDataAdapter("Select DEVICE_NAME,CURRENT_STATE from SUBSCRIBER_DEVICES", con);
da.Fill(ds);
//Binding DataSource with GridView
GridView1.DataSource = ds.Tables[0];
GridView1.DataBind();
// close the connection
con.Close();
}
Thank You.
|
|
|
|
|
Purish Dwivedi wrote: Please help , as I am new to .NET
Then why are you writing data driven ASP.NET code ? That's at least three things you're trying to learn at once. Is it for school, or work ?
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
Try Using RowDataBound event
|
|
|
|
|
|
thanks for the reply, but a new problem is,
that it is changing my column header also.
Any help would be appreciated.
Thank YOu
|
|
|
|
|
Thanks for previous reply. It worked for me.
I have ON or OFF values in a GridView cell. Based on this value I want to show a button (opposite Toggle (OFF/On) correspondingly) in another cell.
This is my code.
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.Cells[2].Text== "0")
e.Row.Cells[2].Text = "OFF";
else
e.Row.Cells[2].Text = "ON";
}
please help.
Thanks...
|
|
|
|
|
You seem to have some trivial work to do, and not be able to work out how to do any of it. Why is this ? Surely no-one is paying for this code, when you have no clue what you're doing ?
Just put a button in a column. The cell itself will tell you if your button has to turn it off, or on.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
This javascript tool has made life more complicate with several
endless ParseErrorException. Is there anyone who has exported gridview to excel with girdview in UpdatePanel . More and More Error. Ajax has created more more trouble in ma life
|
|
|
|
|
AJAX is a complex thing, too many people use the toolkit and have no idea what they are doing. You don't export a gridview to Excel, you export the data source. I don't see how or why you'd use AJAX to do that, that just seems bizarre. How does it export to Excel, as a download ? That makes AJAX pointless, doesn't it ?
'
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
People opens HTML content with xls extension to make their job easier...
|
|
|
|
|
Yes the user want smart output
|
|
|
|
|
It is the Response.Write which does not work inside a button
Response.Clear();
Response.AddHeader("content-disposition", "attachment; filename=MyFile.xls");
Response.Charset = "";
Response.Cache.SetCacheability(HttpCacheability.NoCache);
Response.ContentType = "application/vnd.ms-excel";
System.IO.StringWriter stringWrite = new System.IO.StringWriter();
System.Web.UI.HtmlTextWriter htmlWrite =new HtmlTextWriter(stringWrite);
GRIDVIEW_LIST.RenderControl(htmlWrite);
Response.Output.Write(stringWrite.ToString());
Response.Flush();
Response.End();
|
|
|
|
|
Do you think this is smart output ??
It means an HTML is opened in MSExcel ...
|
|
|
|
|
|
onyang2 wrote: Do you Smoke Marijuana?Frown Frown OMG OMG Cool
Some people thinks a piece of crap a smart output...
|
|
|
|
|
Abhishek Sur wrote: Do you Smoke Marijuana?Frown Frown OMG
You Didnt Answer the Question My Frnd..!
LatestArticle :Log4Net
Why Do Some People Forget To Mark as Answer .If It Helps.
|
|
|
|
|
No Comments.
|
|
|
|
|
Take it easy. We learn by mistakes. Especially when new errors arise. I need a glass of milk or water.
Thanks I have known Response cannot work with ajax
|
|
|
|
|
onyang2 wrote: Take it easy
Its ok budd...
onyang2 wrote: We learn by mistakes.
Even I have learned a lots of things while answering questions ..
|
|
|
|
|
you're obviously clueless, so it is not a good idea to alienate one of the most helpful people on this forum
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
You plainly have no idea what you're doing. Buy a book and read it.
Here's a clue - if you did this outside AJAX, it would do a download, inside an AJAX call, it's not going to work because the browser ( by your request ) is not processing a new request.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
Thanks Outside Ajax it works. I was preventing post backs by placing all controls in the panel. I need a book,, Borrow me yours
|
|
|
|
|
*grin* sure, come over and I'll be happy to lend it to you.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
Actually, more and more you want to simplify your job, more and more complex your job be.
Peoples render the html from Gridview and download it with .xls extension . Excel opens this... But I personally think it is better to generate excel output from actual data.
Use this :
Working with MS Excel(xls / xlsx) Using MDAC and Oledb[^]
to generate Excel files. I think you need to have PostBack trigger to download the file properly from inside the updatepanel.
|
|
|
|