|
Hi all;
I want to be able to get the total number of rows in a gridview with out any sql code.
How would I do that?
Thanks
Hadi
|
|
|
|
|
U may use DataBound event of GridView, and use the Property
Gridview1.Rows.Count
Hope it helps u..
Regards,
Jay
|
|
|
|
|
Thanks for the reply, but this is not what I wanted. what you suggested only returns the number of rows per page. not all the rows of a gridview which is bounded.
I found the answer. You have to use the Selected event of the DataSource which you have bounded to the gridview.
e.AffectedRows
Thanks again
Hadi
|
|
|
|
|
Thanks Hadi, for your information. Its very useful.
Regards,
Jay
|
|
|
|
|
comm.CommandText = "select BrandID, Brand, ('Logo_Pics/'+BrandLogo) as BrandLogoFile from Brand";
SqlDataReader dr2 = comm.ExecuteReader();
DropDownList1.DataSource = dr2;
DropDownList1.DataBind();
dr2.Close();
this code above is to bind the sql database data to my dropdownbox1
i need help to make the first choice of the drop down list box to all
without putting in inside the sql database
can this be done?
example:
old:
1 // from sql
2 // from sql
3 // from sql
wat i want:
All // not from sql
1 // from sql
2 // from sql
3 // from sql
|
|
|
|
|
Hi,
First of all fill the drop down combo with the sql output. Then insert new item like this -
DropDownList1.Items.Insert(0, "All");
<marquee>"A good programmer is someone who looks both ways before crossing a one-way street." -- Doug Linder
Anant Y. Kulkarni
|
|
|
|
|
|
thx u it works like a dream haha
|
|
|
|
|
Hi Frends
I wanna call a java function on page load event on my .aspx.cs page and want to pass some values from there....but its not working.....
I am doing like this....
this.Attributes.Add("onload", "setObj('Dinesh','Sharma',550,30)"); not working
actually i need to call this java function on page load so i can use it like
<body 'onload'="setObj('Dinesh','Sharma',550,30)"> but i cant pass the values from my .cs page is there any way to pass the value from .cs page
Dinesh Sharma
-- modified at 3:59 Saturday 19th August, 2006
Dinesh Sharma
|
|
|
|
|
Don't write whole sentences in bold. It serves no purpose other than making it harder to read.
What you are using is not Java at all, it's Javascript.
DineshSharma wrote: this.Attributes.Add("onload", "setObj('Dinesh','Sharma',550,30)"); not working
Standard question #1:
What do you mean by "not working"?
The Page object (that "this" references to) is the page itself, not a control on the page, so you can't add attributes to it. So I assume that the error message is that the object doesn't have any "Attributes" property.
Put an id on the body tag and make it a server tag, so that you can access it from code behind:
<body id="Body" runat="server">
Now you can declare the reference and put the call to the Javascript in the onload event:
protected HtmlGenericControl Body;<br />
<br />
Body.Attributes.Add("onload", "setObj('Dinesh','Sharma',550,30)");
---
b { font-weight: normal; }
|
|
|
|
|
Hi guffa
thanks for your great help.....Now I am able to do this .
Thanks
Dinesh Sharma
|
|
|
|
|
HI,
hw r u all,i have a problem ,i have a website that i made in asp.net and vb.net.in this website i want to uppload image on my websever folder name as "Images",and that images i displayed in my datagrid..locally on my machine its working well,bt no i want to test it on my webserver,tell me how can i athunticate against the username and password that my webserver used to uplaod files,here ist he code that i locally use
Dim f_info As New FileInfo(UploadFile.Value)
If f_info.Extension = ".bmp" Or f_info.Extension = ".gif" Or f_info.Extension = ".jpg" Then
Dim f_name As String = System.IO.Path.GetFileName(UploadFile.Value)
'f_name=f_name.Replace(f_name.Substring(0,f_name.
Dim insert_path As String = "images/" + f_name
Dim save_location As String = Server.MapPath("../images" + "/" + f_name)
'Dim phy_location As String = Request.PhysicalPath
UploadFile.PostedFile.SaveAs(save_location)
Image_SaveToDBURL(insert_path).
tell me how can i uplaod image on the webserver through proper Authentication
kindly help me in this regard
|
|
|
|
|
Until now I'm setting the Control page like this:
<%@ Register TagPrefix="Menu" TagName="Bottom" Src="Bottom.ascx" %>
On the top of the page.
But now I need to set the Src dynamicly.
eg.: <%@ Register TagPrefix="Menu" TagName="Bottom" Src="Session["ID"] + "/Bottom.ascx" %>
Something like this.
Now I know that this is not how to do it, but maybe you can help me?
|
|
|
|
|
Hi,
I am using asp.net 2.0. In this,i am using Cross Page Posting. From the second page, i am trying to reference a control (Label) in the prevoius page using 'PreviousPage' property.
Here, in the first page, that Label control is placed within the <asp:Content> tag. (ie I am using MasterPage's ContentPlaceHolder).
Page.PreviousPage.FindControl("lebelid") method return null.
I am tried with refering the NamingContainer before refering the actual control (Label), which is placed within that NamingContainer. It also gives me the output null.
In my previous page, the Label control present within the tag,
<asp:Content ID="Content5" ContentPlaceHolderID="BodyContent" Runat="Server">
</asp:content>
In my second page (using same masterpage) code behind file, i am refering like this,( in Page_Load event)
ContentPlaceHolder myContent = (ContentPlaceHolder)Page.PreviousPage.FindControl("BodyContent");
Still it returns null.
Can anyone help me in this? Thanks in advance.
Regards,
Jay
|
|
|
|
|
Jay_se wrote: ContentPlaceHolder myContent = (ContentPlaceHolder)Page.PreviousPage.FindControl("BodyContent");
The sample code is updated slightly:
ContentPlaceHolder holder = (ContentPlaceHolder)Page.PreviousPage<code>.Controls[0]</code>.FindControl("BodyContent");
|
|
|
|
|
Dear member,
Thanks for your help. It works fine. But i dont know, what this Controls[0] represents?? Can u pls explain me.
Thanks a lot.
Regards,
Jay
|
|
|
|
|
Jay_se wrote: what this Controls[0] represents??
It represents the MasterPage at runtime which in nature is the user control. If you set the Trace="true" in the first page, the control hierarchy of the trace info will give you some ideas.
|
|
|
|
|
Once again Thank you very much .. I have understood.
Regards,
Jay
|
|
|
|
|
i am megha working on asp.net 2005, i am using the Session.SessionId to create a session value, bt the value of session gets chenge on every page, it not to be maintain same as first page.
how can i maintain the same value on each page up the site will not close?
Megha
megha
|
|
|
|
|
Hi,
try and create session variable.
Session("id")=Session.SessionId
and also check the Session.Timeout property.
hope this works.
Nitin.
|
|
|
|
|
Hi All! i want a context menu on datagrid at client side using javascript. how will this possible?
|
|
|
|
|
Hi Nigam,
In the Datagrid try with this Code.
//set the action to handle the contextmenu
function oncontextmenu(event)
{
event.cancelBubble = true;
event.returnValue = false;
this.action("contextmenu");
}
// assign the event handler to the cell template prototype
Active.Templates.Text.prototype.setEvent("oncontextmenu", oncontextmenu);
// create action handler for the right click context menu
grid.setAction("contextmenu", function(src){ showmenu(event,getMenuHeader()+menu);return false;});
I hope this will works.
Happy Coding
with regards
Satips
|
|
|
|
|
I have use this method (Cross Page Posting in ASP.NET Webpages)
but in the secend page, the previous page can not be recognized while i have used <%@ PreviousPageType VirtualPath="-/Sourcepage.aspx"> in the secend page but when in the code view mode of the secend page I see all of the public properties of the first page ,but i can`t use them in run time & recieved an error by this message: Object refrence not set to an instance of an object
Best Regards
Hussein Madani Ghomi
+98-912-5577-832
|
|
|
|
|
|
hello all,
i have a datagrid,in the footer template textbox,i want to do decimal validation for the textbox,i have a javascript which does decimal validation,but when i call the javascript in the itemcreated property of the data grid and use attributes.add to call javascript ,the js function is not getting fired,its something like this,
<br />
Try<br />
<br />
If e.Item.ItemType = ListItemType.AlternatingItem Or e.Item.ItemType = ListItemType.Item Then<br />
e.Item.Attributes.Add("onblur", " return CheckDecimal(this);")<br />
End If<br />
<br />
Catch ex As Exception<br />
lblmesg.Visible = True<br />
lblmesg.Text = "Error : " & ex.Message<br />
End Try<br />
i even tried one more method
<br />
Dim tempmin As TextBox = CType(e.Item.FindControl("txtmintemp"), TextBox)<br />
tempmin.Attributes.Add("Onblur", "javascript:CheckDecimal(this);")<br />
but the js function is not getting fired,is ther any other method,or what is the error in the above code,
pls anyone help me
Regards
kavitha
-- modified at 1:24 Saturday 19th August, 2006
|
|
|
|