|
how to add coding to the click event of the pager control in gridview
when i click the pager control i need an alert msg
lik yes or no...
if the user clicks yes only , the page should get to next page or it should stay in the same page
tanx
|
|
|
|
|
Look at this Article in the OnPageIndexChanging event show alert box from there
http://www.codeproject.com/KB/aspnet/Paging_without_a_Wizard.aspx[^]
Vuyiswa Maseko,
Few companies that installed computers to reduce the employment of clerks have realized their expectations.... They now need more and more expensive clerks even though they call them "Developers" or "Programmers."
C#/VB.NET/ASP.NET/SQL7/2000/2005/2008
http://www.vuyiswamaseko.somee.com
vuyiswa@its.co.za
http://www.itsabacus.co.za/itsabacus/
|
|
|
|
|
Hi all,
I haved used a DataTable to fill a grid. On mouse over of a row ,I want to show some other info about this row in some textboxes . I really dont know how to do this.
Can anyone help?
Thanks in advance.
|
|
|
|
|
onmouse over this is how we do it
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
e.Row.Attributes.Add("onmouseover", "this.style.backgroundColor='Silver'");
e.Row.Attributes.Add("onmouseout", "this.style.backgroundColor='White'");
}
}
now you can choose to to add what you want your grid to do, i just did the color changing.
Vuyiswa Maseko,
Few companies that installed computers to reduce the employment of clerks have realized their expectations.... They now need more and more expensive clerks even though they call them "Developers" or "Programmers."
C#/VB.NET/ASP.NET/SQL7/2000/2005/2008
http://www.vuyiswamaseko.somee.com
vuyiswa@its.co.za
http://www.itsabacus.co.za/itsabacus/
|
|
|
|
|
hi Vuyiswa Maseko
thank u for the answer
i already know how to change the color of the rows,but calling a javascript function to get some other details about that row from the dataTable is somehow complex.
i can't pass that row to the function so that i can extract the fields and display them in textboxes .
|
|
|
|
|
hii...
i hav 3 textbox named:txtqty,txtproductprice,txttotalprice.
i want that when the cursor goes to txttotalprice.the txttotalprice
textbox get initialized by the value which is multiple of txtqty and txtproductprice.i hav used the textbox changed event of txttotalprice
like this:
<asp:textbox id="txttotalprice" runat="server" ontextchanged="txttotalprice_TextChanged">
then i hav coded it like this:
protected void txttotalprice_TextChanged(object sender, EventArgs e)
{
string s = txtqty.Text;
string k = txtproductprice.Text;
int i = Convert.ToInt32(s);
int j = Convert.ToInt32(k);
int l = i * j;
txttotalprice.Text = Convert.ToString(i);
}
but it doesnt show any value in txttotalprice...
|
|
|
|
|
mylogics wrote: protected void txttotalprice_TextChanged(object sender, EventArgs e)
{
string s = txtqty.Text;
string k = txtproductprice.Text;
int i = Convert.ToInt32(s);
int j = Convert.ToInt32(k);
int l = i * j;
txttotalprice.Text = Convert.ToString(i);
}
--instead use
{
double i = double.parse(txtqty.Text);
double j = double.parse(txtproductprice.Text);
double l = i*j;
txttotalprice.Text = l.Tostring();
}
|
|
|
|
|
If you have no idea what the answer is, it's best to stay silent. Your code is not functionally different from his, and both suffer from the same basic problem.
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.
|
|
|
|
|
hiii
still not workin.it just shows nothin in txttotalprice.
|
|
|
|
|
This sort of thing gets posted EVERY day. Imagine if your page actually refreshed EVERY time you typed something ?
This event fires if you force a postback by other means. To do what you want, it needs to be done in javascript,
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.
|
|
|
|
|
Why you don't use javscript for that calculation?
I Love T-SQL
"Don't torture yourself,let the life to do it for you."
If my post helps you kindly save my time by voting my post.
www.aktualiteti.com
|
|
|
|
|
can u give me some idea hw cud i use javascript for this calculation...
|
|
|
|
|
Here it is.
function Calculate()<br />
{<br />
document.getElementById('<%=txttotalprice.ClientID%>').value=<br />
document.getElementById('<%=txtqty.ClientID%>').value * <br />
document.getElementById('<%=txtproductprice.ClientID%>').value<br />
}
I Love T-SQL
"Don't torture yourself,let the life to do it for you."
If my post helps you kindly save my time by voting my post.
www.aktualiteti.com
|
|
|
|
|
hi
you know , i think you`d better not do that like this !!!
because ontextchanged , sends the information to the server andyour page relodes and takes so much time !
it`s better to do this on client side with java script
something like this :
var quantity = document.getElementById('txtqty').value;
var price = document.getElementById('txtproductprice').value;
document.getElementById('txttotalprice').value = quantity*price;
|
|
|
|
|
is there any other way to do this without using javascript
bcoz i dont know javascript n how to implement it...
|
|
|
|
|
javascript is the best way
if you have a masterpage , the way that blue boy said is better than mine
code it like this in your .aspx page :
<script language="javascript" type="text/javascript">
the code that blue boy said
</script>
|
|
|
|
|
oh i forgot to say something else
in your code that you made textboxes you must add this function like this :
<asp:TextBox ID="textboxtotalprice" runat="server" MaxLength="20" onfocus="Function_name();"></asp:TextBox>
|
|
|
|
|
its not workin...
function Calculate()
{
document.getElementById('<%=txttotalprice.ClientID%>').value=
document.getElementById('<%=txtqty.ClientID%>').value *
document.getElementById('<%=txtproductprice.ClientID%>').value
}
<asp:textbox id="txttotalprice" runat="server"
="" ontextchanged="txttotalprice_TextChanged" autopostback="True" oninit="Calculate()">
wat to do...
|
|
|
|
|
change it to this one :
<script type="text/javascript" language="javascript">
function Calculate()
{
document.getElementById('<%=txttotalprice.ClientID%>').value=
document.getElementById('<%=txtqty.ClientID%>').value *
document.getElementById('<%=txtproductprice.ClientID%>').value
}
</script>
<asp:TextBox ID="txttotalprice" runat="server" onfocus="Calculate()">
notice that javascript is Case Sencetive !
|
|
|
|
|
hiii....
sir there is no onfocus event....
the events are..
oninit(),onload(),onunload(),onprerender(),ontextchanged()...
which event shud i use...
|
|
|
|
|
hehehe i know
visual studio is stupid
javascript runs at client computers , so don`t worry
just use it
|
|
|
|
|
hiii
great finally it worked...
thanks alot...
thank you very much sir specially sajjy,padmanabhan and blue boy...
Best Regards
pari....
|
|
|
|
|
You are welcome.
I Love T-SQL
"Don't torture yourself,let the life to do it for you."
If my post helps you kindly save my time by voting my post.
www.aktualiteti.com
|
|
|
|
|
//as sajjy says
function total()
{
var quantity = document.getElementById('txtqty').value; var price = document.getElementById('txtproductprice').value; document.getElementById('txttotalprice').value = quantity*price;
}
//call that event in the textbox onblur():
<asp:textbox id="textbox name" runat="server"
onblur="total()">
|
|
|
|
|
hiii
onblur event does not exist...
oninit(),onload(),onunlload,ontextchanged(),onprerender()...exist
which event shud i use....
|
|
|
|