|
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.
|
|
|
|
|
Hello,
I have made two tables in SQL server : one is tblogin and 2nd is Details.
i want to have the information in the details view in the web form which is opened after successfull login .And that information must be correspondent to the login form.
|
|
|
|
|
Sounds so trivial that you don't even need to write code to do it. Why can't you do it ? What have you tried ?
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.
|
|
|
|
|
In login web form, i have bound login database,
In another web form that opens after successful login, i have bound "details" database.
and. login database have 1 PK cloumn i.e. UserId which is the foreign Key column in details table...
Now , I want to access the information from the details table from UserId corresponding to Id of the login table . i mean ,form must always show the details of the ID that has been logged in, from the details table that is bound the web form
|
|
|
|
|
OK - so it sounds like perhaps you need to write your own SQL to achieve what you want ? Do you know anything about SQL ? Do you know how to use ADO.NET to connect to a database ? Although I said you can probably do it without writing code, the fact is that no professional solution would work that way.
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.
|
|
|
|
|
Retain the logged in user's id (through session maybe). Fire a query on the details table to get the data for the logged in user. Display it on the page.
It's not necessary to be so stupid, either, but people manage it. - Christian Graus, 2009 AD
|
|
|
|
|
During Login process place a sessionkey of current userid into session from User table.
If you details Id is UserId you can easily fetch from session :
"SELECT * FROM DETAILS WHERE ID = " + Session["UserID"]
Use SqlCommand object to fire the query and get the output.
Finally Bind the output with any UIElement you want to .
Before you do any code read about ADO.NET first so that you know what you are doing. You might follow this link :
ADO.NET Tutorial[^]
|
|
|
|