|
PDTUM wrote:
//Define the row and cell
int theRow = Convert.ToInt32(e.CommandArgument);
Does the value of theRow Comming properly ? Where did you set value for CommandArgument ?
PDTUM wrote: //Pass the pdf information, start the users Pdf Reader
Process.Start(thePdf);
What are you doing here? This will not start the pdf reader on client system. It will execute only on server.
Abhijit Jana | Codeproject MVP
Web Site : abhijitjana.net
Don't forget to click "Good Answer" on the post(s) that helped you.
|
|
|
|
|
Hi Abhijit,
The e.CommandArguement value for the row is correctly reported, depending on the row that was selected. As for the Pdf, I appreciate your input. I have not gotten far enough yet to see this problem (I just jotted it down without testing it). Please correct as necessary... ...BUT first I need to be able to retrieve the text from the cell. I am sure the error is coming from the Rows value of this line:
GridViewRow gvr = (GridViewRow)GridViewResults.Rows[theRow];
NOT the value of [theRow]. Unfortunately, I am stuck at this point. Thanks again for your help. Any ideas?
|
|
|
|
|
PDTUM wrote: GridViewRow gvr = (GridViewRow)GridViewResults.Rows[theRow];
Simply use
GridViewRow gvr = GridViewResults.Rows[theRow];
Why you are using RowCommand event where as you are not using any Command Name? Why you are not using Selection index changed ?
Please go through the link
Abhijit Jana | Codeproject MVP
Web Site : abhijitjana.net
Don't forget to click "Good Answer" on the post(s) that helped you.
|
|
|
|
|
OK....it seems the gvr will work without the cast (I tried it)....BUT....I was using the RowCommand event to get the number of the selected row so I could pass it in. I suppose I could use both events and pass the row number to a class level variable, but why not do everything at the same time? Either way, the issue is not with the row number, but rather because the NUMBER OF ROWS being reported is NULL according to the GridViewResults.Rows.Count script. If I can determine why this is, I think the problem will be solved. Thanks for your help....I'm still working on it...keep in touch, Pat
|
|
|
|
|
OK Gentleman,
Thank you all. I have found that rows of the GridView were being nullified during postback by a method call on the Page_Load event. For those of you with a similar issue, the final working code regarding how to get row and cell data from a gridview in ASP.NET, here is a perfect and easy solution code using the RowCommand event:
protected void GridViewResults_RowCommand(object sender, GridViewCommandEventArgs e)
{
GridViewResults.EnableViewState = true;
int count = GridViewResults.Rows.Count; //Checks for a positive returned number of rows
//Define the row and cell
int theRow = Convert.ToInt32(e.CommandArgument); //Gets the Row Number
int theCell = 6; //Defines the Cell Row
//Get the Row information
GridViewRow gvr = GridViewResults.Rows[theRow]; //Creates a GridViewRow Object
//Get the information from the cell
string thePdf = gvr.Cells[theCell].Text; // Returns the data from the selected Cell
To all you guys out there....ENJOY.
|
|
|
|
|
PDTUM wrote: I have found that rows of the GridView were being nullified during postback by a method call on the Page_Load event.
This is one of the common mistake done in begining while binding any data with some control. You should take care about Page.IsPostback Property.
Abhijit Jana | Codeproject MVP
Web Site : abhijitjana.net
Don't forget to click "Good Answer" on the post(s) that helped you.
|
|
|
|
|
Gridview shouldn't bind in postback
so bing your datagrid as follows. This will fix ur problem..
if (!IsPostBack)
{
BindGridView();
}
-Ravi Kakumani
|
|
|
|
|
Ravi,
Thank you for your reply. The solution that I posted in an earlier message is working perfectly in all browsers. I appreciate your input and hope that you will be available to assist me on other issues as they arise.
Best Regards, Pat
|
|
|
|
|
hey im using mscharts im unable to show multiple columns value or the value of one row selected from database one either axis of web chart(either on X aixs or on y axis) .. plz help me buddies really needed urgently..
here is my row eg:
title|2006|2007|2008|2009|
bmat |1.70|8.69|4.67|23.8|
i have installed .net framework 3.5 sp1
and vs addons , mscharts...plz help buddies
any guidence will be appreciated
|
|
|
|
|
|
let me check.. thanks
|
|
|
|
|
hey abhijit its showing some error...
can u guide me a bit more thanks in advance
|
|
|
|
|
What error it is show ? How you are trying to open the application?
cheers,
Abhijit
CodeProject MVP
Web Site:abhijitjana.net
When you ask a question, remember to click "Good Answer", If the Answer is helps you.
|
|
|
|
|
now i have done rectification working.... let me look for thing of my purpose...
|
|
|
|
|
Hi,
I am wanting to create an asp.net website, that will allow the user to download a software. So instead of downloading the software, I want if the user click on download button, the software gets started installation.
How this can be achievable?
Burhan-
|
|
|
|
|
Member 1597230 wrote: I want if the user click on download button, the software gets started installation
Would you mind to tell us why you want to do this?
This is ually done for installing malware.
Manas Bhardwaj
Please remember to rate helpful or unhelpful answers, it lets us and people reading the forums know if our answers are any good.
|
|
|
|
|
No. You can't, Unless you are using some ActiveX control. But this will work only on IE.
But the Idea is
cheers,
Abhijit
CodeProject MVP
Web Site:abhijitjana.net
When you ask a question, remember to click "Good Answer", If the Answer is helps you.
|
|
|
|
|
Abhijit you are right...this solution also prompt in my mind, actually I want to monitor the downloading process and display the status of web page that such and such % has been downloaded, or the link breaked you need to re-try, thing like that...
I dont know how to achieve this.
|
|
|
|
|
Hi,
I have developed one small asp.net application using express edition (both VS2008 and SQL server).
I want to launch that application. can i launch my own website with this application as it is built in express edition. Or do i need to buy VS standard or professional edition for this just to make sure everything is LEGAL?
I don't have any plan to earn from it, it will be free to login.
Also
second thing, which hosting provider will be best and cheap to launch such a website.
Please help,
Lucky
|
|
|
|
|
There won't be any problem to deploy applications created using Express edition. In fact, there is no way to identify the tool you have used to create the application once you have deployed it.
I'd suggest http://bizhostnet.com/[^]. Worked well for me all the time.
|
|
|
|
|
|
Just show us the code for creating the textbox.
cheers,
Abhijit
CodeProject MVP
Web Site:abhijitjana.net
When you ask a question, remember to click "Good Answer", If the Answer is helps you.
|
|
|
|
|
function addkeywordBox()
{
if (!document.getElementById || !document.createElement)
return false;
var keywordArea = document.getElementById ("keyword-area");
if (!keywordArea)
return;
var newLine = document.createElement ("br");
keywordArea.appendChild (newLine);
var newkeywordBox = document.createElement ("input");
// Set up the new input for file uploads
newkeywordBox.type = "text";
newkeywordBox.size = "60";
// The new box needs a name and an ID
if (!addFileUploadBox.lastAssignedId)
addFileUploadBox.lastAssignedId = 100;
newkeywordBox.setAttribute ("id", "dynamic" + addkeywordBox.lastAssignedId);
newkeywordBox.setAttribute ("name", "dynamic:" + addkeywordBox.lastAssignedId);
keywordArea.appendChild (newkeywordBox);
addkeywordBox.lastAssignedId++;
}
|
|
|
|
|
I am not sure but may be it helps you. When dynamically creating controls keep track of their client ids then when you need data entered in those controls upon post back search their parent control for those ids, cast object to text box and extract their value. This answer is specific to ASP.NET.
|
|
|
|
|
thanks for your solution Muhammad...but then i'll have to pass number of textboxes from javascript to C#
and then access htmltextbox from C#...its a good solution..but bit tiresome
|
|
|
|