|
i have htmltable created dynamically in my page by javascript function..
this table is filled with data ..
i wanna access this htmltable data in code behind to send it to the sqlserver .
|
|
|
|
|
legend_of_zanado wrote: i have htmltable created dynamically in my page by javascript function..
this table is filled with data ..
i wanna access this htmltable data in code behind to send it to the sqlserver
you have no idea what you are doing. I suggest you try this[^].
led mike
|
|
|
|
|
Sheesh - it seems that people don't appreciate it when you try to help them. Never mind, I've 5ed to correct the imbalance.
|
|
|
|
|
Yeah, that guy is about as clueless as they come eh? If we could post binaries I would post a DLL that had a SolvesYourProblem() method exported that ShellExecuted that URL.
led mike
|
|
|
|
|
If you spell it correctly, you will get a more relevant search result. Obviously "carrer" is a usual enough word that google doesn't suggest a correction.
search for "career change"[^]
Search for "spell checker"[^]
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
Yes you are absolutely right! Thank you. <sarcasm>I will take more time to proof for typos in my future posts to people that have no idea what they are doing or I am talking about. It should seriously improve communications with them.
Seriously, I mean you can't even explain to these morons that they need to read and study the tutorials and reference material available on the technology they are attempting to use. They think that because they know what a loop and an if statement is they can program anything by asking questions about all the rest in internet forums. They are completely unqualified, hopeless and have choosen the wrong carrer. DAMN!
led mike
|
|
|
|
|
The entire html code is not sent back to the server. The only data that is sent to the server is the values in the fields in the form that is posted. If you have any data that you want to access from the server, you have to put it in form fields.
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
hello,
i have a table which i'm populating it dynamically, i need to read th value of a specific cell i tried "tabel.Rows[1].Cells[1].Text" it's gaving me an empty value="";
i tried tr.Cells[1].Controls[0] it's not working also BUT while i'm testing it on the WATCH panel of VS 2003, when i wrote :
tr.Cells[1].Controls[0].Text it gave me the value i want, but the ".Text" can't be implemented in the code coz it's not exist!!
please if someone could help.
thank you
|
|
|
|
|
michael_jhons wrote: i tried "tabel.Rows[1].Cells[1].Text"
michael_jhons wrote: i tried tr.Cells[1].Controls[0]
Why would you try both of those? Don't you know what you put in the cells?
led mike
|
|
|
|
|
Dear Mike
maby i miss-explained what i want to do,
i have a table which contain a checkBox on the first cell of each TableRow, so foreach tableRow i'm checking if the the first cell is checked i read the value of the second cell so i can use it to delete A certain row from my database, so i must read the value.
please if you have an answer of my question, help me
thank you for your concern
|
|
|
|
|
michael_jhons wrote: so i must read the value.
What value? You still have not posted what you put in the Cell that you want to read? Don't you know?
led mike
|
|
|
|
|
the table is already populated its full of values i want to retreive that value.
here's the code:
foreach(TableRow tr in TbTariffTb.Rows)
{
TableCell cell = tr.Cells[0];
TableCell celCli=tr.Cells[1];
foreach (Control control in cell.Controls )
{
CheckBox checkBox = control as CheckBox;
if (checkBox != null)
{
if (checkBox.Checked)
{
}
}
}
}
|
|
|
|
|
michael_jhons wrote: the table is already populated its full of values
Populated how? Dude, you have now posted THREE times and you still have NOT SPECIFIED what you are putting in those cells that you want to read from. Without that information we can't help you. I'm done with you now, good luck.
led mike
|
|
|
|
|
your on a good way but there is a slight detail.
Your Code:
foreach(TableRow tr in TbTariffTb.Rows){TableCell cell = tr.Cells[0];TableCell celCli=tr.Cells[1];foreach (Control control in cell.Controls ){ CheckBox checkBox = control as CheckBox;if (checkBox != null){ if (checkBox.Checked) {
}}}}
My Advice
foreach(TableRow tr in TbTariffTb.Rows)
{
CheckBox checkBox = tr.FindControl("IDofYourCheckBox");
if (checkBox.Checked)
{
foreach (TableCell cell in tr.Cells)
{
String value = cell.Text;
}
String Value = tr.Cells[1].Text;
String Value2 = ((TextBox)tr.Cells[1].Controls[0]).Text;
}
}
|
|
|
|
|
ou might even have to cast:
CheckBox checkBox = (CheckBox)tr.FindControl("IDofYourCheckBox");
|
|
|
|
|
thank you a lot digimanus, i really apreciate your answer a lot
thank you
|
|
|
|
|
digimanus i tried all methods u gave me, which i alresdy tried it before
String Value2 = ((TextBox)tr.Cells[1].Controls[0]).Text;
an error occured it gives me: specified cast is not valid, do you think textbox is the control which has to be specified for this cell ?
thank you for your help
|
|
|
|
|
IS the row in Edit mode? (EditIndex > -1 in GridView)
Than use the above code
Else
String Value2 = tr.Cells[1].Text;
Otherwise.
Set a breakpoint on the line with the (TextBox) cast.
When reaching the breakpoint (Build = debug)
add a watch on
tr.Cells[1].Controls
See how many controls the Count gives. If larger than 1 try in the watch
all other controls in the array like
tr.Cells[1].Controls[1]
tr.Cells[1].Controls[2]
tr.Cells[1].Controls[and so on]
In that case you can see in which control your data exists.
Have Fun
|
|
|
|
|
it's alright i was populationg the cell by this method:
tablecell.Controls.Add(new LiteralControl(SomeString));
when i used tablecell.Text=SomeString;
it's working fine
Thanks for the help
|
|
|
|
|
Hi,
I have a DataGrid that have a dataset as a data source.
The dataset is being returned from a web service.
The code:
webservice.service1 srv = new webservice.service1();
DataSet ds = srv.GetDataSet();
Session["dataset"] = ds;
datagrid1.DataSource = Session["dataset"];
datagrid1.DataMember = "SomeTable";
datagrid1.DataBind();
When editing a row in the DataGrid the DataGrid is affected by the changes
but the DataSource remains the same as before the edit.
What is the problem ?
|
|
|
|
|
after setting the SelectedIndex, reload the DataSet again and bind it again to the datagrid.
|
|
|
|
|
When I do that, the DataGrid shows the old DataSet (before the edit)
|
|
|
|
|
What do you use to update the data in the database?
Stored Procedures?
Or is stating the DataSource method ApplyChanges() enough because of using other ways to communicate with the database ?
In other words. First update the data in the database before retrieving it again otherwise you are stuck with the original data.
|
|
|
|
|
I guess I wasnt clear enough, Ill try to describe the problem again.
The web service has two functions the first one retrives a DataSet and the second one gets DataSet
as a parameter and save it to the DataBase with DataAdapter.
After I get the DataSet from the web service I bind it to the DataGrid (as decribed In my first message)
when I make changes throgh the DataGrid I expect that the DataSet will change but it doesnt,
that's why its irrelevant to save it back in the DB at this stage.
Why does the DataSet doesn't change when I'm changing the DataGrid ?
|
|
|
|
|
It is very simple.
You are in disconnected state with the database. So after changing data in the gridview you have to change the data in the database. The webservice retrieves it data from the database. So after a change your webservice seems to run a type of reload data from the database.
After a change in a gridview you have to update the data in database.
your working order is:
Load data from database
Bind it to the grid
Edit a row
Update the data from the row in the database (You can use .SelectedValue property to see the DataKeyName and/or DataKeyValue. In that case you can update the row with the SelectedValue als key for the where)
After updating you load data again from the database
|
|
|
|