|
i don't know how to disable 'back' button,
but,
I have a idea ....
suppose, u have 10pages as 1.aspx,2,3,....9.aspx
now the user moves from page 3.aspx to 4.aspx
now, when the user arrives at 3.aspx, use Session["pagenumber"]="3";
when the user navigates to page 4.aspx, change it as Session["pagenumber"]="4";
at the entry of each page (in the page load function) check this entry !
|
|
|
|
|
hi all,
I just want to retrieve the cell value from the gridview using the following
code,but it returns nothing null
plz help me
protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e)
{
int index = e.RowIndex;
//here to delete in data base
//the problem in the next code this string (spareid)carry null
string spareid = GridView1.Rows[index].Cells[0].ToString();
new DataAccess.Service().SparePart_Delete(spareid);
//here to delete in dataset to reflect in gridview
DataSet ds = (DataSet)Session["dataset"];
ds.Tables[0].Rows[index].Delete();
GridView1.DataSource = ds;
GridView1.DataBind();
//here notification for delete
lblmsg.Text = "delete ok ";
lblmsg.Visible = true;
}
plz help me i dont know where is the error
thanks in advice
Kareem Elhosseny
|
|
|
|
|
Is your page load interacting with your grid at all ? If you look at this code in the debugger, do any of the cells have data for that row ? For any row ?
Tell me it's not really called gridview1 ???
Christian Graus
Please read this if you don't understand the answer I've given you. If you're still stuck, ask me for more information.
|
|
|
|
|
|
No, that won't cause it, perhaps you could answer my questions ?
Christian Graus
Please read this if you don't understand the answer I've given you. If you're still stuck, ask me for more information.
|
|
|
|
|
Dear friend;
my question why the cell carry null value ?
i make all solution but it also carry null
Kareem Elhosseny
|
|
|
|
|
I can't answer you, because I asked you questions to try to work out the problem and you did not answer them.
Christian Graus
Please read this if you don't understand the answer I've given you. If you're still stuck, ask me for more information.
|
|
|
|
|
Christian Graus wrote: Tell me it's not really called gridview1 ???
. Last week I was invited to one company for checking their code and giving some advice for their project. I can see a gridview named as gridView256 ! The page which they wrote contained 256 gridviews and all named like gridview1 .. 256. What a disaster !
|
|
|
|
|
im not using any server controls
with regards,
bretto
|
|
|
|
|
I also face that type problem. at that time i change the cell index even the original cell index is =0, Try this ..
|
|
|
|
|
Are you binding the grid in the page load ? make sure you are doing it inside "!IsPostBack" blocks.
elhosseny wrote: string spareid = GridView1.Rows[index].Cells[0].ToString();
It's not safe to do the above. "Rows[index]" returns a row instance which may be NULL or the cell may be NULL. Check it is NULL, if not proceed with delete.
|
|
|
|
|
ok i'll change the gridview name is it the solve for my problem
where the solution ???????????????????????????????????????????????????????????????????????????????????????
Kareem Elhosseny
|
|
|
|
|
Try This
String Str = GridView1.Rows[e.RowIndex].Cells[0].Text;
Bharani
|
|
|
|
|
my brother i make exactelly this code
Kareem Elhosseny
|
|
|
|
|
is there a problem when i make all column as a templet filed is this make the problem
Kareem Elhosseny
|
|
|
|
|
No, There wont be any problem if u Made all the field to be template
Bharani
|
|
|
|
|
The name just makes your code readable, it plainly won't solve the issue
Christian Graus
Please read this if you don't understand the answer I've given you. If you're still stuck, ask me for more information.
|
|
|
|
|
I know i spend more time in this problem and i dont know where is the error
here is my code again
the cell value return null again where is the problem
protected void grdSparepart_RowDeleting(object sender, GridViewDeleteEventArgs e)
{
//my problem here the string be null WHY???????????
string spareid = grdSparepart.Rows[e.RowIndex].Cells[0].Text;
new DataAccess.Service().SparePart_Delete(spareid);
DataSet ds = (DataSet)Session["dataset"];
ds.Tables[0].Rows[e.RowIndex].Delete();
grdSparepart.DataSource = ds;
grdSparepart.DataBind();
lblmsg.Text = "delete ok ";
lblmsg.Visible = true;
}
Kareem Elhosseny
|
|
|
|
|
If you have DataKey attribute set of your GridView then you know:
GridView1.SelectedIndex = e.RowIndex;
In that case you know the GridView1.SelectedValue and that is your DataKey.
With that value you can do a delete in the database and after that reload your DataSet ds and Databind() it to GridView1.
Have Fun
|
|
|
|
|
i am working in .net2.0
i am getting the imageURL from database and store this value in a variable
how call this variable in design page image src . my img is html control it is not a server control
with out using cookies , session
my coding like
.aspx.cs file
borderimage="images/br.git";
.aspx
<img src="<%=borderimage%>" />
but it dose not working
please help me
with regards,
bretto
|
|
|
|
|
Any errors are you getting ? if so the whats the error could please write here !!!
Thanks,
Arindam D Tewary
|
|
|
|
|
hi it display error like this
The name 'border_tr' does not exist in the current context
with regards,
bretto
|
|
|
|
|
and what is border_tr ?
Christian Graus
Please read this if you don't understand the answer I've given you. If you're still stuck, ask me for more information.
|
|
|
|
|
brettokumar wrote: The name 'border_tr' does not exist in the current context
but where are you using this variable ? I can't see this in the code given.
|
|
|
|
|
brettokumar wrote: but it dose not working
What does 'does not work' mean ? Does it compile ? Does it create HTML ?
Christian Graus
Please read this if you don't understand the answer I've given you. If you're still stuck, ask me for more information.
|
|
|
|