|
|
I had create data bases with one table. I add a data connection to the data base from Visual Studio 2005. I drag the table to default.aspx form. When I click on the small arrow in the right of the “GridView Task” I can’t see Enable Deleting.
N.B: I can see the data when I run the project in the default.aspx form.
What is the most case of this problem?
Thanks
|
|
|
|
|
Hi,
I'm trying to make sense of what to do!!
I have the following SQL statement in a stroed procedure:
SELECT
OrderItemID_PK,
WineID_FK,
OrderItemUnitPrice,
OrderItemQty,
OrderID_FK
FROM
OrderItems
WHERE
OrderID_FK = @OrderID;
I only need the wine ID to populate the Wine object. In my DA class I did it like this:
// Do connections and stuff here
while (dr.Read())
{
OrderItem objOrderItem = new OrderItem();
// Populate other fields
Wine objWine = Wine.GetWineByWineID(dr.GetInt32(1)); // Related Wine object
objOrderItem.OrderItemWine = objWine; // Required
}
OrderItemWine is a property in the OrderItem class that sets the Wine object. I declared the Wine object in the OrderItem class like this:
private Wine m_Wine;
And the property that sets this Wine object in the OrderItem class is:
public Wine OrderItemWine
{
get { return m_Wine; }
set { m_Wine = value; }
}
Like this I can retrieve Wine information, now how do I get the wine name into my gridview, if I didn't define a Coloumn as such for the DataField property??
Please help.
Regards,
ma se
|
|
|
|
|
You can try and add a separate function into the datafield template, that calls the name of the wine, using the id you got from the select query, for that specific field.
EG: As the following into your
GetNameForID(wineID) //Id for the wine name you want to add here
or how about using parent/child relationship repeater or datagrid?
|
|
|
|
|
Why not join the table with the wine name in your stored procedure and add the column to you grid???
The other option is to add a template column with a label. Then use the ItemDataBound event of the grid and populate the label via code. However, I would think the first method would be much more efficient and simpler.
//inside the itemdatabound method
DataRowView dr = (DataRowView) e.Item.DataItem;
//something like this
LabelWineName = objWine(dr["WineID_FK"]).name;
Note that if the wine class is make a database call then you are really making a mistake. The join in your original proc would be much more efficient.
how vital enterprise application are for proactive organizations leveraging collective synergy to think outside the box and formulate their key objectives into a win-win game plan with a quality-driven approach that focuses on empowering key players to drive-up their core competencies and increase expectations with an all-around initiative to drive up the bottom-line. But of course, that's all a "high level" overview of things
--thedailywtf 3/21/06
|
|
|
|
|
Thanks for this, but then what is the use of having class relations?? Or am I missing the plot her??
|
|
|
|
|
Yeah, you are missing the point. With an ASP.Net application all of the server side code has to run between postbacks. In other words 99% of your code is executed in < 1 second of time. How many class objects can you instantiate during that time interval? Not many. Even when I only working with only one database record I usually use a structure instead of class because it has less overhead.
I have been programming ASP.Net applications for 5 years now and have coded about 25 applications. Most of them have only a couple class files, not including our base class.
how vital enterprise application are for proactive organizations leveraging collective synergy to think outside the box and formulate their key objectives into a win-win game plan with a quality-driven approach that focuses on empowering key players to drive-up their core competencies and increase expectations with an all-around initiative to drive up the bottom-line. But of course, that's all a "high level" overview of things
--thedailywtf 3/21/06
|
|
|
|
|
hi
i need to do urlrewriter in asp.net with c#
now I have done it someway but
it gives me error of magicajax
I have used ajax methods and ajaxzone of magicajax in some pages to fill up datagrid and dropdownboxes
the error tell me to add an httphandler for ajax in web.config. but i have already added it still gives error.
<httphandlers>
<add verb="POST,GET" path="ajax/*.ashx" type="Ajax.PageHandlerFactory, Ajax">
<httpmodules>
<add name="MagicAjax" type="MagicAjax.MagicAjaxModule, MagicAjax">
thx in advanced
max
|
|
|
|
|
Hi! Is there a method to unregister client script block in ASP.net 2.0.
I'm using ClientScript.RegisterStartupScript to register client script which needs to be unregistered based on a condition.
Many thanks.
|
|
|
|
|
just use ClientScript.RegisterStartupScript(page.gettype(), "sameName", "");
problem solved.
how vital enterprise application are for proactive organizations leveraging collective synergy to think outside the box and formulate their key objectives into a win-win game plan with a quality-driven approach that focuses on empowering key players to drive-up their core competencies and increase expectations with an all-around initiative to drive up the bottom-line. But of course, that's all a "high level" overview of things
--thedailywtf 3/21/06
|
|
|
|
|
i have created a guestbook module. it contains many guestbooks.
Each guestbook contains messages.
There is a guestbook detail page, showing guestbook details (name, start date, end date, ....) and messages (with paging of course). I found when pagesize is 400 (and there are 400 hundred message or more), then all buttons (with postback) in the guestbook detail page doesn't work.
after i click it, the page will show error "can not find server", as we usually encounter when we open a browser with no internet connection or the address we type is incorrect)
|
|
|
|
|
JohnnyChiu wrote: i have created a guestbook module.
That's nice.
Did I miss the question or are you just detailing to everyone what happens when you try to load large amounts of data on a page?
only two letters away from being an asset
|
|
|
|
|
i am looking for any sugguestion on fixing this problem.
|
|
|
|
|
hi guys, i think you people are fine and safe.!
i got a new error while i tried to create a new asp.net webapplication. the project has been created without any files;( ie without assemblyinfo.vb,web.config or even any .aspx pages) and returned one error "SPECIFIED MODULE COULD NOT BE FOUND". when i tried to add a new aspx page to my existing application , i got another error "UNSPECIFIED ERROR".
have ever seen these errors ;
could any body say why these error occurs and how to solve this.
thanks in advance
happy programming
sebastian
|
|
|
|
|
Nothing to worry,
just re-install the dotnet your error will be rectified.
|
|
|
|
|
thanks. i was looking to solve that problem with out reinstalling the .net.
and i would like to know the reason behind this error. if u know anything detail abt this pls share....
sebastian
|
|
|
|
|
Hey man try to install IIS once agian......You will get your answer...
Regards:
Geetika Munjal
|
|
|
|
|
thank you. i ahve already reinstalled the .net
|
|
|
|
|
hi,
I need to disable back and forward button in a IE Page.
How can I do it using C#,ASP.NET?
Thanks in advance..
|
|
|
|
|
Page A calls Page B
User should not be allowed to go to Page A from Page B.
Put the code below in Page A.
To Disable Back
window.history.forward(1);
To Disable Forward
window.history.back(1);
|
|
|
|
|
hi,
I need to do custom paging of datagrid and datalist in format
<<prev 1="" 2="" 3="" 4="" next="">>
Please help. I tried many logics but no sets . please show with some code if possible.
Regards,,
max
|
|
|
|
|
This is complete code with stored procedure.Try this.This will definitely work.
Imports System.Data.SqlClient
Imports System.data
Imports System.Collections
Partial Class _Default
Inherits System.Web.UI.Page
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Pagebind(1)
End Sub
Public Function Pagebind(ByVal pg As Integer)
Dim nor As Integer
Dim repcol As Integer
nor = DropDownList1.SelectedValue
If (nor <= 4) Then
repcol = nor
Else
repcol = nor / 2
End If
DataList1.RepeatColumns = repcol
Dim con As New SqlConnection
con.ConnectionString = ConfigurationManager.ConnectionStrings("testConn").ConnectionString
con.Open()
Dim cmd As New SqlCommand
cmd.CommandText = "paging"
cmd.Connection = con
cmd.CommandType = CommandType.StoredProcedure
cmd.Parameters.Add("@pagenumber", SqlDbType.Int).Value = pg
cmd.Parameters.Add("@pagesize", SqlDbType.Int).Value = nor
Dim dr As SqlDataReader
dr = cmd.ExecuteReader()
dr.Read()
Dim tot As Int32
tot = dr(0)
Label1.Text = pg.ToString()
Label2.Text = "of"
Label3.Text = Convert.ToInt32(tot / nor).ToString
Dim i As Int32
Dim ar As New ArrayList
For i = 1 To Convert.ToInt32(Label3.Text)
ar.Add(i.ToString())
Next i
DataList2.RepeatColumns = ar.Count
DataList2.DataSource = ar
DataList2.DataBind()
If (dr.NextResult()) Then
DataList1.DataSource = dr
DataList1.DataBind()
End If
dr.Close()
cmd.Dispose()
Button1.Enabled = True
Button2.Enabled = True
Button3.Enabled = True
Button4.Enabled = True
If pg = 1 Then
Button1.Enabled = False
Button2.Enabled = False
End If
If pg = Convert.ToInt32(Label3.Text) Then
Button3.Enabled = False
Button4.Enabled = False
End If
End Function
Protected Sub DataList2_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles DataList2.SelectedIndexChanged
Pagebind(DataList1.SelectedIndex + 1)
End Sub
Protected Sub DropDownList1_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles DropDownList1.SelectedIndexChanged
Pagebind(1)
End Sub
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
Pagebind(1)
End Sub
Protected Sub Button2_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button2.Click
Pagebind(Convert.ToInt32(Label1.Text) - 1)
End Sub
Protected Sub Button3_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button3.Click
Pagebind(Convert.ToInt32(Label1.Text) + 1)
End Sub
Protected Sub Button4_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button4.Click
Pagebind(Convert.ToInt32(Label3.Text))
End Sub
End Class
CREATE PROCEDURE paging
@pagenumber int,
@pagesize int
/*
(
@parameter1 int = 5,
@parameter2 datatype OUTPUT
)
*/
AS
declare @srec int
declare @erec int
declare @spid int
declare @epid int
declare @rc int
set @srec=@pagenumber*@pagesize-@pagesize+1
declare c_prd scroll cursor for
select productid from products order by productid
open c_prd
fetch absolute @srec from c_prd into @spid
select @rc=count(*) from products
where productid>@spid
if @rc < @pagesize
Begin
set @erec=@srec+@rc
end
else
Begin
set @erec=@pagenumber * @pagesize
end
fetch absolute @erec from c_prd into @epid
close c_prd
select count(*) from products
select productname,unitprice,categoryname from products a ,categories b
where a.categoryid=b.categoryid
and productid>=@spid
and productid<=@epid
/* SET NOCOUNT ON */
RETURN
GO
If u have any queries then don't hesitate
kartik rathi@gmail.com
kartik rathi
|
|
|
|
|
|
Hi,
I need your suggestion, I have created an Windows service to mointer my mail id, it stores the content of the mail in the data base. I want to install my service in an remote system. I dnt know how to do it.
Plz suggest me how to install it in remotew machine........
Thanks in advance
Bye
Exelio
Know is Drop, Unknown is Ocean
|
|
|
|
|
simple
-go to visual studio command prompt
-installutil -i [path of that service i.e exe]
This command will install the service in windows services
Depending on the start mode i.e Automatic,manual the service is started
-- modified at 5:38 Thursday 14th September, 2006
|
|
|
|