|
Your page which needs to be updated should give AJAX calls to the server frequently, get the data and bind to the grid.
|
|
|
|
|
I have not used AJAX at all. Is there any requirements that users are required to have in order to run AJAX? Also I forgot to mention but the main page is the page but the actual gridview is from a web control. I don't think it makes much of a different but thought I should share.
|
|
|
|
|
Are you talking about the Update Panel?
|
|
|
|
|
Jacob Dixon wrote: I have not used AJAX at all. Is there any requirements that users are required to have in order to run AJAX?
AJAX is javascript. You use XMLHttpRequest and XMLHttpResponse objects included in the browser to make AJAX calls. Users don't need to install anything, other than a supporting browser. Most of the browsers supports AJAX.
Jacob Dixon wrote: Also I forgot to mention but the main page is the page but the actual gridview is from a web control.
MS has a AJAX toolkit which provides easy interface to develop AJAX enabled applications. It's worth downloading. Use UpdatePanel control, put your webcontrol inside this update panel. Update panel is capable to update in the specified intervals. Gridview in webcontrol doesn't make any difference.
|
|
|
|
|
Ok I will give that a try, thanks a bunch! I didn't think it would make a difference about the web control but thought I should share just in case.
|
|
|
|
|
Ok I put my gridview in the UpdatePanel and it says I have to make a public property for GridView which its talking about the ID right?
|
|
|
|
|
Jacob Dixon wrote: I have to make a public property for GridView which its talking about the ID right?
I am not getting your point. Are you getting an error ?
|
|
|
|
|
Yes I am.. I fixed it, I found by searching google (took a few websites) but had to put :contenttemplate -- gridview here -- contenttemplate
How do I set how often it updates though? And does it refresh the page or can I point it to a method that just does: GridView.DataBind(); ?
|
|
|
|
|
It won't refresh the whole page. It will update only the panel area.
Jacob Dixon wrote: How do I set how often it updates though?
Use Timer control. Check this[^]
|
|
|
|
|
Before I re-invent the wheel, I thought I'd ask if anyone knew of such a beast. I've tried searching Google for various combinations of 'add', 'remove', 'listbox', 'asp.net', and I've only managed to find WinForm controls (see: http://www.vbdotnetheaven.com/UploadFile/mgold/AddRemoveUserControls04262005080452AM/AddRemoveUserControls.aspx[^])
For those that don't want to click the link, I'm basically looking for a control that has a list of items in listbox1 and buttons to move selected items to listbox 2. The main difficulty I find in doing it myself is getting the layout to work properly. I'm assuming you'd need to use CSS positioning to get everything lined up properly.
Josh
Find a penny, pick it up, and all day long you'll have a back-ache...
|
|
|
|
|
Those things are javascript driven and are as old as dirt. Search for javascript code to do this, not ASP.NET code.
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
I'm aware that the actual code to implement the functionality would be client side javascript. My main problem (which I probably didn't state clearly, and why I was looking for a control someone had already created) was how to actually create the layout of the control in a web application. I'm not very familiar with CSS positioning, but I'm assuming that is what I would need to get the control layout to mimic what can be done just by dragging the buttons around on a WinForm application. Perhaps since this is a CSS/positioning question, it might be better for another forum, but since I was looking for control that someone might have already created, I wanted to look here first. I've managed to create the layout using tables, so I guess that will be good enough.
Josh
Find a penny, pick it up, and all day long you'll have a back-ache...
|
|
|
|
|
Dear all,
what do you think is the best way to store html content for sections of the page.
The options is see are either storing in database which may be the easiest by can be slow or make use of some flat file or xml file. However with xml there will be problems with parsing because of the html tags.
What are your comments and suggestions?
Thanks a lot,
Chris
|
|
|
|
|
If you have worries about speed, a DB is going to be the fastest.
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
As CG said, DB is fast.
ChrisFarrugia wrote: However with xml there will be problems with parsing because of the html tags.
There won't be if you put the HTML content to a CDATA section.
|
|
|
|
|
Hi all.
I have written a simple application in vb.net (2.0) that reads data from an excel sheet (previously stored in focus databases) and stores it into a sql server database. I am using typed datasets and table adapters to store the data. I have an "Import" button whose event handler does the following in turn.
1. connect to the excel sheet through an ole db conn
2. read the contents in a while loop using the executeReader() method
3. store the values in variables where necessary conversions and validations are performed.
4. call an insert method in the associated dataset tableAdapter that stores these processed values in the sql db.
This is all working as it should. Now I need to check for existing records before I import the values - Ignore completely if the value is found.
According to msdn, I should be able to use my tableAdapters update method by passing a dataSet/Table/Row(s). So this is how I tried to tackle it.
Legend:
lbf = my DataSet
lbf_COKEnCOLE = the Database table associated with lbf DataSet
GetRecordByIdDateLab = runs the following SQL Query on the data
SELECT *
FROM lbf_COKEnCOLE
WHERE (ORIGINATOR_ID = @ORIGINATOR_ID) AND (SMPL_DTE = @SMPL_DTE) AND (LAB_NUM = @LAB_NUM)
(The actual sql refers to all the columns by names instead of using *)
'Code starts here
Dim tableadapter As New lbfTableAdapters.lbf_COKEnCOLETableAdapter
Dim dataTable As lbf.lbf_COKEnCOLEDataTable = Nothing
'check for existing record by using GetRecordByIdDateLab method
dataTable = tableadapter.GetRecordByIdDateLab(ORIGINATOR_ID, SMPL_DTE, LAB_NUM)
If Not dataTable Is Nothing Then
If dataTable.Rows.Count > 0 Then
If Not dataTable(0).ORIGINATOR_ID = Nothing Then
'Row = dataTable(0)
dataTable(0).TURN = TURN
tableadapter.Update(dataTable) '<<THIS IS WHERE IT CRASHES WITH "A first chance exception of type 'System.InvalidOperationException' occurred in System.Data.dll
End If
'The following tableAdapter works perfectly whenever the condition is true (for new entries that is)
ElseIf dataTable.Rows.Count = 0 Then
tableadapter.InsertQuery(counter, ORIGINATOR_ID, SMPL_DTE, LAB_NUM, TURN)
End If
End If
****************************************
More details:
I have DataTable under "Watch" and the value for it shows up as "dataTable has not been declared". This ofcourse is misleading because it is, plus intellisense picks it up where I'm updating the column values by referencing them with dataTable(0).columnName
I have been wondering if
dataTable = tableadapter.GetRecordByIdDateLab(ORIGINATOR_ID, SMPL_DTE, LAB_NUM)
does what its supposed to do, ie. return a dataTable with the matching record. I tried to recieve the data in a row but it only allowed it to be saved in a datatable instantiated in this manner. Furthermore, when I read the values read into the datatable, each column value shows up only as lbf_COKEnCOLE.column (something to this effect) in curly braces. Almost everything else thats returned, like index values and what not that I suppose is used to keep the schema of the table has errors in it.
Any suggestions and help would be greatly appreciated!! I am trying to avoid suddenly using command objects when I'm doing everything else through a data Access layer. lastly, I have read and reread this msdn page
http://msdn.microsoft.com/en-us/library/ms233819(VS.80).aspx
and am trying to do everything as shown here, obviously to no avail
All .net people out there, if you would help this awkward programmer, it would be greatly appreciated! Thanks
~Ghazanfar
|
|
|
|
|
Hi,
I apologize for double post, but this is very urgent, and I don't know how to do it.
I have to create a table with unknown number of rows. There should be a button for adding a new row and a button for deleting selected rows (in each rows there is a cell with a checkbox for deleting). I started with AJAX, but I'm a newbie, so I stuck. I can now add new rows, but have no clue how to delete them. Is there anyone who could help?
Here's my code (for now):
<asp:updatepanel id="UpdatePanel1" runat="server">
<contenttemplate>
<asp:table id="receivingInstitutionsTable" runat="server">
</asp:table>
</contenttemplate>
<triggers>
<asp:asyncpostbacktrigger controlid="ButtonAddNewReceivingInstitution" eventname="Click" />
<asp:asyncpostbacktrigger controlid="ButtonDeleteReceivingInstitutions" eventname="Click" />
</triggers>
</asp:updatepanel>
That's my table and two buttons - one for adding new row, and second for deleting selected rows. And this is inline code:
static int numberOfReceivingInstitutions = 1;
ArrayList receivingInstitutionsArrayList = new ArrayList();
protected void Page_PreInit(object sender, EventArgs e)
{
Control controlWhichCausedPostBack = GetPostBackControl(this.Page);
if ((controlWhichCausedPostBack != null))
{
if ((controlWhichCausedPostBack.ClientID.ToString() == "ButtonAddNewReceivingInstitution"))
{
numberOfReceivingInstitutions += 1;
}
}
}
protected override void OnInit(EventArgs e)
{
base.OnInit(e);
for (int i = 0; i < numberOfReceivingInstitutions; i += 1)
{
TableRow newReceivingInstitution = getNewRow();
newReceivingInstitution.ID = "receivingInstitution" + i.ToString();
receivingInstitutionsTable.Rows.Add(newReceivingInstitution);
receivingInstitutionsArrayList.Add(newReceivingInstitution);
}
}
|
|
|
|
|
Hey, guys.
The web controls typically have a CssClass="yadayada" attribute for formatting via the css style sheet. However, I'm finding it's occasionally difficult to map the declarative attributes of a control to the corresponding elements in the style sheet. GridView is a great example but it's just one of many where a clear one to one mapping is not always obvious.
I'd like to think that this is explicitly documented somewhere and I'm just overlooking it. Does anyone know where in the MDSN docs these attribute to style sheet equivalents are spelled out?
Thanks,
|
|
|
|
|
I don't understand what you are looking for. CssClass just becomes the 'class' attribute of the HTML element produced.
led mike
|
|
|
|
|
I probably didn't word the question very well. Naturally, at the moment I can't find a specific example of areas where this has been a problem. Using GridView for illustration, you have a huge list of attributes, such as AlternatingRowStyle-BackColor, etc. Since you're dealing with a table, some of these relate to header cells, some apply to regular cells, some apply to the table itself, etc., all of which dictates which style elements to tweak in your css file.
Obviously there's no realy mystery with the Label control, but with the more complex grids, menus, etc. I find no documentation that maps, for instance, AlternatingRowStyle-BackColor to the header cell, BorderStyle to, perhaps, the table element, etc. This is the documentation I'm looking for. I recall Googling on GridViews back when I was having a problem with this and found that it wasn't an uncommon experience.
Does that clarify?
|
|
|
|
|
Christopher Duncan wrote: Does that clarify?
Not really. They all go into the output HTML somewhere so all you have to do is set one or more and run it and View Source on the page to see where they went or "mapped to" if that's what you mean.
led mike
|
|
|
|
|
how can i define a error path in my domain to a file like errorpath.aspx
thanks for any help
|
|
|
|
|
Turn on custom errors in web.config and supply file name which you would like to show upon an error.
|
|
|
|
|
in web.config :
<system.web>
<customerrors defaultredirect="errorPage.aspx" mode="on" />
</system.web>
Every road leads to Rome.
|
|
|
|
|
thanks for help, but exactly i wanna change a file not have in my web to a correct file like default.htm
for example: my file have address: http://localhost/myweb/helloworld.aspx
but customer type on their brower is http://localhost/myweb/sdfsdf
the result of this errors is redirect to http://localhost/myweb/helloworld.aspx
i try to use .htaccess with content
<files ~="^.(htaccess|htpasswd)$">
deny from all
ErrorDocument 404 /helloworld.aspx
|
|
|
|