|
Can some please explain how the "auto" paging option of the DataGrid web control is meant to work?
My datasource is a class derived from CollectionBase. Now the first page shows up fine, but when I click any other page number, nothing happens, the page does not display anything but the first page. The event gets fired as well, but that seems only of use when you want to do custom paging.
Wasnt there an ASP.NET forum on CP?
Cheers
MYrc : A .NET IRC client with C# Plugin Capabilities. See
http://sourceforge.net/projects/myrc for more info.
|
|
|
|
|
You still need to handle the event, even when it's automatic. All you actually need to do in that event handler is: DataGrid1.CurrentPageIndex = e.NewPageIndex but having to handle it yourself gives you the control to do other things.
For example, if you had an EditCommand column in the datagrid and someone hits edit on the fourth row, then pages to the next page, the EditItemIndex is still going to be set to 4, so you need to set it back to -1 in the PageIndexChanged event.
Paul
|
|
|
|
|
Thanx Paul
You forget to mention though to do another DataGrid.DataBind().
Its all fine now
MYrc : A .NET IRC client with C# Plugin Capabilities. See
http://sourceforge.net/projects/myrc for more info.
|
|
|
|
|
Ooops!
It was there in my datagrid but I thought that was just to pick up the information from the DataSet. You're right though, now I think back, you have to DataBind after setting the CurrentPageIndex, EditItemIndex or the SelectedItamIndex.
I don't understand why though and it can be very inconvenient.
Paul
|
|
|
|
|
I have played with NDoc a free open source doc generator for C#. However, it even though it does a good job a creating MSDN like, it is not 100% like the MSDN docs, the same with it's Java Doc output.
I was wondering if anyone knows of or has used other freeware/shareware/open source doc generators for C#. Since the only thing I can find is NDoc.
I played with an expensive commercial product that does a perfect and flawless job at generating MSDN looking docs and has a great interface. However it is very expensive for a single developer.
Now I do not know why .NET does not come with a built in tool like Java does. And the one in Visual Studio sucks big time, seems to have lots of bugs, or does not fully support all the .NET tags yet.
Anyways... thanks in advance for any input...
Aalst
Coding is a way of life. It's in the air we breath. It pumps through our vines. Without it we soon crumble to dust. - Rodney S. Foley
|
|
|
|
|
Why not just modify the nDoc source code?
Cheers,
Simon
"Sign up for a chance to be among the first to experience the wrath of the gods.", Microsoft's home page (24/06/2002)
|
|
|
|
|
That was the first thing I tried. However, I do not know about you, but trying to figure out someone else code is bad enough, but trying to figure out code that is supported by 13 developers, that has little to no documentation is extremely difficult. It is not just one simple C# Project. It is divided into about a half dozen projects. A few classes have some documentation, however most of them do not.
The one little think I would like, is in there feature request tracker, they are just looking for someone to do it for them or one of the 13 developers to feel like doing it.
It would take a lot of my time just to get a basic handle on their code. So I though I try to save time and ask if there is anything else out their that is not commercial.
Aalst
Coding is a way of life. It's in the air we breath. It pumps through our vines. Without it we soon crumble to dust. - Rodney S. Foley
|
|
|
|
|
hi,
I don't have an answer (i'm using NDoc too), but have another question
What's the name of that commercial product you mention ?
Thanks,
Andres Manggini.
Buenos Aires - Argentina.
|
|
|
|
|
The one that I was refering to is DocumentX it from a UK company. It does a great job with a good interface. It costs about $385 USD for a single user license without a support subscribtion.
Aalst
Coding is a way of life. It's in the air we breath. It pumps through our vines. Without it we soon crumble to dust. - Rodney S. Foley
|
|
|
|
|
OK, so I have a good idea to start my first web project.
I feel dumb
I create the objects and then as soon as i leave the scope they are gone...null i mean. It's pretty much the same code I use in a windows application. What is so different that I'm not seeing?
MYrc : A .NET IRC client with C# Plugin Capabilities. See
http://sourceforge.net/projects/myrc for more info.
|
|
|
|
|
leppie wrote:
I feel dumb
Don't....it's not good for your self esteem!
Web sites are stateless. If you create an object at the page scope it is gone just as soon as you render the page. To keep it around you will need to either put it into session, put it into the page cache, or serialize it somewhere else and bring it back when needed.
If I'm going in the wrong direction, let me know, I'll see if I can help out. If you want me to look at some code...no prob!
Thanks,
ed
Every time I walk into a singles bar I can hear Mom's wise words: "Don't pick that up, you don't know where it's been!"
|
|
|
|
|
Ed K wrote:
To keep it around you will need to either put it into session, put it into the page cache, or serialize it somewhere else and bring it back when needed.
I ended making the objects static, and placed them in the Global class, this seems to work fine...not sure if this OK, but things look like its working like it should. I'll play some more after some needed sleep.
MYrc : A .NET IRC client with C# Plugin Capabilities. See
http://sourceforge.net/projects/myrc for more info.
|
|
|
|
|
Aalst wrote:
error CS0019: Operator '|=' cannot be applied to operands of type 'bool' and 'int'error CS0019: Operator '|' cannot be applied to operands of type 'bool' and 'int'error CS0030: Cannot convert type 'int' to 'bool'error CS0030: Cannot convert type 'byte' to 'bool'error CS0030: Cannot convert type 'bool' to 'byte'
int | int //yes
byte | byte //yes
bool | bool //yes
(int)byte| int //yes
int | bool //no
byte | int //no
The type must be the same
MYrc : A .NET IRC client with C# Plugin Capabilities. See
http://sourceforge.net/projects/myrc for more info.
|
|
|
|
|
I double checked my testing and yes of the same type seems to work. I had an error in the test. A little annoying but better than I thought it was.
Thanks for the correction.
Can you Riddle Me This leppie... Why can't I cast an int or byte to a bool? if it is 0 it would become false, anything else would be true.
Thanks again... sorry for the invalid grip.
Aalst
Coding is a way of life. It's in the air we breath. It pumps through our vines. Without it we soon crumble to dust. - Rodney S. Foley (a.k.a. Aalst)
|
|
|
|
|
Aalst wrote:
Can you Riddle Me This leppie... Why can't I cast an int or byte to a bool? if it is 0 it would become false, anything else would be true.
Then the Convert class would be of not much use
O 5AM must get some sleep
MYrc : A .NET IRC client with C# Plugin Capabilities. See
http://sourceforge.net/projects/myrc for more info.
|
|
|
|
|
Good. I didn't know about this class. However, doesn't seem silly to have a whole class that does the work that should be done by a simple cast? Or is this have something to do with .NET and it's multi-language support and not all languages support casting or something like that.
Again thanks for the class info.
Coding is a way of life. It's in the air we breath. It pumps through our vines. Without it we soon crumble to dust. - Rodney S. Foley
|
|
|
|
|
The C# designers purposely designed it this way to prevent errors like...
if (a=0) {} instead of if (a==0) {}
Anyway you can just explicitly write out the ==0.
|
|
|
|
|
I have several string and decimal values that I have to enter into my table through an sql statement. I have one problem. When one of my date fields is null, the table automatically enters the default 1/1/1900. I need to find another way around this. That field needs to stay blank if it is originally blank.
what my code looks like:
string connstr = "my connection to db";
string sSQLCommand = "INSERT INTO t340(cmd_dsg,trns_cd,proc_act_cd,inp_act_cd," + "blk_tkt_no,blk_tkt_dt,seq_no,updt_cd,jono,eor,comt_ref_no,oblg_ref_no_spiin,cost_cen_mgr,docu_dt,act_amt,wi_fed_govt_cd,oblg_stat_cd,oblg_expir_dt,jv_no,oblg_ty_cd,amd_no,qty,wt_lbs,hrs,nomenclature,clin,acrn,mod_no,subjono,ifs_docu_no,lbr_pay_pd_no,prod_ind,reject_cd,correction_cd,load_date)" +
"VALUES('" + cmd_dsg + "','" + trns_cd + "','" + proc_act_cd + "','" + inp_act_cd + "','" + blk_tkt_no + "','" + blk_tkt_dt + "','" + seq_no + "','" + updt_cd + "','" + jono + "','" + eor + "','" + comt_ref_no + "','" + oblg_ref_no_spiin + "','" + cost_cen_mgr + "','" + docu_dt + "'," + act_amt + ",'" + wi_fed_govt_cd + "','" + oblg_stat_cd + "','" + oblg_expir_dt + "','" + jv_no + "','" + oblg_ty_cd + "','" + amd_no + "'," + qty + "," + wt_lbs + "," + hrs + ",'" + nomenclature + "','" + clin + "','" + acrn + "','" + mod_no + "','" + subjono + "','" + ifs_docu_no + "','" + lbr_pay_pd_no + "','" + prod_ind + "','" + reject_cd + "','" + correction_cd + "','" + ldate + "');";
//Create the command object
SqlConnection myConnection = new SqlConnection(connstr);
SqlCommand cmdAdder = new SqlCommand(sSQLCommand, myConnection);
myConnection.Open();
int nNoAdded = cmdAdder.ExecuteNonQuery();
myConnection.Close();
Everything else works. I need to know if there is another way to insert each value and to be able to use an if statement for when the field is blank. I was able to do this in VB but I am having to convert this program.
this is what the VB looked like:
qstr = "Select * from t340 where cmd_dsg = '1111111111111'"
Set temprec = New ADODB.Recordset
temprec.CursorType = adOpenDynamic
temprec.CursorLocation = adUseClient
temprec.Open qstr, cnn1, adOpenKeyset, adLockOptimistic, adCmdText
temprec.AddNew
temprec!cmd_dsg = cmd_dsg
temprec!trns_cd = trns_cd
temprec!proc_act_cd = proc_act_cd
temprec!inp_act_cd = inp_act_cd
temprec!blk_tkt_no = blk_tkt_no
If blk_tkt_dt <> "" Then
temprec!blk_tkt_dt = blk_tkt_dt
End If
temprec!seq_no = seq_no
temprec!updt_cd = updt_cd
temprec!jono = jono
temprec!eor = eor
temprec!comt_ref_no = comt_ref_no
temprec!oblg_ref_no_spiin = oblg_ref_no_spiin
temprec!cost_cen_mgr = cost_cen_mgr
If docu_dt <> "" Then
temprec!docu_dt = docu_dt
End If
temprec!act_amt = act_amt
temprec!wi_fed_govt_cd = wi_fed_govt_cd
temprec!oblg_stat_cd = oblg_stat_cd
If oblg_expir_dt <> "" Then
temprec!oblg_expir_dt = oblg_expir_dt
End If
temprec!jv_no = jv_no
temprec!oblg_ty_cd = oblg_ty_cd
temprec!amd_no = amd_no
temprec!qty = qty
temprec!wt_lbs = wt_lbs
temprec!hrs = hrs
temprec!nomenclature = nomenclature
temprec!clin = clin
temprec!acrn = acrn
temprec!mod_no = mod_no
temprec!subjono = subjono
temprec!ifs_docu_no = ifs_docu_no
temprec!lbr_pay_pd_no = lbr_pay_pd_no
temprec!prod_ind = prod_ind
temprec!reject_cd = reject_cd
temprec!correction_cd = correction_cd
temprec!load_date = load_date
temprec.Update
temprec.Close
Could someone please help?
|
|
|
|
|
You could allways just make a collection and override the toString method or make a new method, to output each element. And override the Add method. For example:
class Queries : ArrayList {
...
public override int Add(object obj)
{
return base.Add(obj.ToString());
}
public override stringToString()
{
string output = "";
foreach (string query in this)
{
output += "," + query;
}
return output;
}
}
MYrc : A .NET IRC client with C# Plugin Capabilities. See
http://sourceforge.net/projects/myrc for more info.
|
|
|
|
|
You could use a stored procedure instead of dynamic SQL.
Then you could put the IF inside that.
Any reason you're wanting to use a blank string instead of a NULL for the default date?
Cheers,
Simon
"Sign up for a chance to be among the first to experience the wrath of the gods.", Microsoft's home page (24/06/2002)
|
|
|
|
|
I didn't try NULL, I didn't even think about using that in C# because it didn't work in my VB code. Thanks, I will try it.
|
|
|
|
|
Hi,
Through "My Network Place" in Windows Exploer, we can see the entire network hierarchy. I am looking for a way to recreate this hierarchy in C# and display it in treeview. I have been seeing lots of examples for Directory, DirectoryInfo class to get local information. But how about network? I appreciate your help!!
|
|
|
|
|
Actually it is a directory. I don't know what the equivelant in c# is or if there is an equivelant, but in mfc you use the SHGetFolderLocation with CSIDL_NETHOOD to access the NetHood directory.
|
|
|
|
|
Hi,
I think my problem is easy to solve, but I'm giving too much time while I can solve it in other ways (uglier ones...).
That's it:
I've got a form which instantiates a simple form to get a user & pwd. When the Show method is finished I would like to get the values of the strings (properties) in the calling form. I can do it creating two public strings at the called form which are initialized to the Edit Controls value and read by the calling form when the Show method finishes.
It's a simple solution, but I want a better one:
Is it possible to pass the reference of the local strings to the constructor of the called form so when the Show method finishes the calling form already has the initialized values?
I also tried to use Marshal interface and IntPtr, but the solution became uglier by moments...
Does anyone know how to manage it?, is it possible?, maybe is there any similar solution which save me to create to public strings in the called form?
Thank you in advance,
Edgar
__________________________________________
Edgar Berengena Moreno
Software Engineer
Appeyron Research
|
|
|
|
|
Default param passing is by ref, so nothing prevents you from the caller Form to do this :
Form2 f = new Form2();
f.SetFormData(m_arrayData);
f.Show();
where m_arrayData is whatever collection, such as System.Collections.ArrayList for instance.
Be warned though that .Show() returns immediately after the Form is displayed, thus you never know when the collection is updated, etc. Unless instead of passing a collection, you pass a class with a collection member and a SetDirty() method to tell the caller.
Another interesting point is that the Form2 subform should not call you, but instead raise an event the caller Form has subscribed for. That's much more standard C#/Java programming-style.
See http://www.codeproject.com/csharp/delegates-part1.asp[^]
And I swallow a small raisin.
|
|
|
|
|