|
Hello,
The below code returns the image-button that causes the post back. However it causes another problem. when I clicked one of the image_button (that is placed in datalist), the items of that datalist disappear.
Please, please help. I am dealing with this problem for a while now, and it is drawing me crazy.
Please click on any "Ekle" button in this Page[^] to what I mean.
private string getPostBackControlName()
{
Control control = null;
string ctrlname = Page.Request.Params["__EVENTTARGET"];
if (ctrlname != null && ctrlname != String.Empty)
{
control = Page.FindControl(ctrlname);
}
else
{
string ctrlStr = String.Empty;
Control c = null;
foreach (string ctl in Page.Request.Form)
{
if (ctl.EndsWith(".x") || ctl.EndsWith(".y"))
{
ctrlStr = ctl.Substring(0, ctl.Length - 2);
c = Page.FindControl(ctrlStr);
}
else
{
c = Page.FindControl(ctl);
}
if (c is System.Web.UI.WebControls.Button ||
c is System.Web.UI.WebControls.ImageButton)
{
control = c;
}
}
}
if (control != null)
{
return control.ID;
}
else { return "budegil";}
}
|
|
|
|
|
i hav a gridview with check box in it
if i click the checkbox
the value should be saved
tanx
|
|
|
|
|
Check if you bind always gridview on page load.
try this
<br />
if(!Page.IsPostBack)<br />
{<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
|
|
|
|
|
anbusenthil wrote: gridview with check box
I just google with the above string and first result is this[^].
Please do some searching then post.
|
|
|
|
|
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
|
|
|
|