|
you can set a message/post approve system which control by one or more site admins
Nav.
|
|
|
|
|
Yeah, I was gonna say the same thing too. He can also create a dictionary of offensive words/phrases, and create a utility of some kind that checks user inputs against that list as a pre-approval process. Just a suggestion!
Nila Fridley
|
|
|
|
|
IMHO, one of the ways is to provide a link, say Report Abuse, so that other members of the site can use to report it to the admin board. Also, to gain more attention from the gurus here, you might consider posting this question in the lounge (as I don't think it's a programming question ) where you can get a couple of golden tips from someone like the Lord Chris, code-frog, Andy Brummer ....
|
|
|
|
|
If your site is running on a Windows server, you could try parsing the output of...
nbtstat -A ipaddress
Jeremy Falcon
|
|
|
|
|
Hello all,
in asp.net 1.1 webform, in this form one gird, having 4 columns, one column is checkbox, rest of the 3 columns are having some data.
There is a button below the grid. when selecting a checkbox from grid & clicking on the button. my code is
foreach(DataGridItem dgi in datagrid1.Items) <br />
{<br />
string temp = dgi.Cells[2].Text <br />
}
my problem is temp string is displaying blank.
how to get the 2nd cell value?
regards
GV Ramana
|
|
|
|
|
use the DataBound event for getting the selected row and its values
Nav.
|
|
|
|
|
thx for reply
I have one button below the grid.
when clicking on that button i am getting the text of 2nd cell and doing some operation. for that i need.
How i will get?
plz tell me
regards
GV Ramana
|
|
|
|
|
you can get value in ItemDataBound event and save it to string and use it in any function you want to use you can get value in ItemDataBound like this.
CheckBox cb = CType(e.Item.Cells(0).Controls(0), CheckBox); <br />
if(cb.Checked == true) <br />
string temp = e.Item.Cells(2).Text.ToString();
Nav.
|
|
|
|
|
It looks like you are getting ALL the info for each row in the datagrid. This will overwrite string temp with the last row, which is the footer of the datagrid and therefore it will be blank.
You could test the checkbox in the forloop looking for the checkbox enabled
or / and
Have a string array and copy the cell information into the array
or
Use ItemDataBound on the row you wish to select to store the data.
Look where you want to go not where you don't want to crash.
Bikers Bible
|
|
|
|
|
Hi
plz understand my qtn. in my grid 2nd value field is name. with that name i am doing some operation
foreach(DataGridItem dgi in datagrid1.Items) <br />
{<br />
CheckBox chk = (CheckBox)dgi.Cells[0].FindControl("chkSelect");<br />
if(chk.Checked)<br />
{<br />
string sName = dgi.Cells[2].Text <br />
CallingAnotherFunction(sName);<br />
OneMoreOperation(sName);<br />
}<br />
}
this entire thing will happen when clicking on button.
my problem is i am getting everytime sName is blank.
regards
GV Ramana
|
|
|
|
|
How do you define the second column? Is it a bound column or a template column? Basically, you can use the Text property at a specific cell when the column is a bound column. If it is displayed via a control, you need to get reference to the control first, then get the value.
|
|
|
|
|
second column is template colummn in this i am binding like this
<ItemTemplate><br />
<%# DataBinder.Eval(Container.DataItem, "EMAIL")%><br />
</ItemTemplate>
plz tell e
regards
GV Ramana
|
|
|
|
|
Because you are using the data binding expression with the Template column, so the DataBoundLiteralControl is generated in each cell, and you need to cast the control in the Controls collection to this type before you access the Text property:
DataBoundLiteralControl lit = item.Cells[2].Controls[0] as DataBoundLiteralControl;
string value = lit.Text;
|
|
|
|
|
Hello All,
I'm trying to do a page which exports a table to Excel. But a set of statements gets printed on my page, when i try to export it again. The statements are:-
"Server: Microsoft-IIS/5.1 Date: Fri, 21 Jul 2006 11:32:11 GMT X-Powered-By: ASP.NET X-AspNet-Version: 1.1.4322 Content-Disposition: attachment; filename=FileName.xls Cache-Control: private Content-Type: application/octet-stream; charset=utf-8 Content-Length: 3908 "
At first i used "cache" instead of "viewstate".I thought cachewas making problems but all in vain.
Can anyone tell me what the problem is due to?
Thank you.
Regards,
Jeeva
My Code is:-
ViewState["DataTableExportToExcel"] = (DataTable)grdReportResult.DataSource;
private void ExportToExcel()
{
DataSet ds = new DataSet();
DataTable dt = new DataTable();
dt = (DataTable)ViewState["DataTableExportToExcel"];
ds.Tables.Add(dt.Copy());
clsGeneral objclsGeneral = new clsGeneral(); SaveExcel(objclsGeneral.SaveExcelToServer(ds,MapPath("Excell\\FileName.xls")));
//Procedure for exporting data to excel and save it into the server
//Cache.Remove("DataTableExportToExcel");
}
private void SaveExcelToClientMechine(string fileName)
{
System.IO.FileInfo targetFile = new System.IO.FileInfo(fileName);
Response.Clear();
Response.AddHeader("Content-Disposition", "attachment; filename=" + targetFile.Name);
Response.AddHeader("Content-Length", targetFile.Length.ToString()) ;
Response.ContentType = "application/octet-stream" ; Response.WriteFile(targetFile.FullName);
}
|
|
|
|
|
+ Using the ViewState to save the DataTable is not a good pratice as it's fit for the primitive stypes.
+ At the end of the SaveExcelToClientMechine method, you may try calling the Response.End method to avoid the html markup of the web page added to the output content.
|
|
|
|
|
Hi,
Thank You so much for the solution.
I was really worried with the HTML markup, when i gave Response.End() it came up all right.
Thanks a lot.
Regards,
jeeva
|
|
|
|
|
i want to compare two dates from two different date picker
Premi
|
|
|
|
|
|
System.DateTime got function name CampareTo
Nav.
-- modified at 8:27 Friday 21st July, 2006
|
|
|
|
|
Try this
DateTime dt = DateTime.Now;
DateTime dt2 = DateTime.Parse("August 15, 2000 10:00:00");
TimeSpan ts = dt-dt2;
using ts object you will get everything.
regards
GV Ramana
|
|
|
|
|
Hi there.
I have a user control and a dynamically created dropdownlist on it. When I select an item in the ddl data is supposed to go into a textbox. The problem is that the SelectedIndexChanged event is only fired the second time I select some item in the ddl.
I think the problem has something to do with the viewstate - it's like the event isn't registered in the viewstate the first time I load the user control??
Here is my code which is in the Page_Load function in the user control:
DropDownList cboBUNK = new DropDownList();
cboBUNK.ID = "m_cboBUNK";
cboBUNK.CssClass = "controlText";
cboBUNK.AutoPostBack = true;
cboBUNK.SelectedIndexChanged += new EventHandler( onCboBUNKSelectedIndexChanged );
....
cboBUNK.DataSource = colBunkanr;
cboBUNK.DataTextField = "BUNK";
cboBUNK.DataValueField = "BUNK";
cboBUNK.DataBind();
cboBUNK.SelectedIndex = 0;
....
m_plhBUNK.Controls.Add( cboBUNK );
|
|
|
|
|
Do you add the user control to the web page dynamically or statically? Basically, the event gets fired based on the comparison of the current selected item persisted in the ViewState with the new posted value. IMO you may not need to set the SelectedIndex in the method. Also you may consider adding the dynamic control in the Page_Init other than the Page_Load.
|
|
|
|
|
Thanx 4 answering.
The user ctrl is added to the web page dynamically. I have 3 radio buttons on the page: Create, Edit and Delete.
> If the user chooses Create the placeholder in the user ctrl will contain a textbox control.
> If the user chooses Edit or Delete the placeholder in the user ctrl will contain a dropdownlist control with all the items he can change/delete. And it's that ddl that wont fire onSelectedIndexChanged event for the first time I pick something in it.
I commented out the set of the SelectedIndex and moved the code which adds the textbox/dropdownlist to the placeholder in the OnInit function but it made no difference
Other suggestions?
P.S. IMO?
|
|
|
|
|
I guess that you dynamically add the user control to the web page on postback after the ViewState is loaded. IMO, you can do that in a simpler way:
+ In the user control, you can simply declare two controls textbox and dropdownlist, and depending on which action is taken by the user, you can make the textbox/dropdownlist visible/invisible.
+ In the web page, if you dynamically load the web user control, you can add it in the Page_Init, and depending on which radio button is selected, you can set a public property in the web user control which in turn controls the visibility of the TextBox and dropdownlist. Even simpler, you can declare the web user control right in the web page instead of dynamically loading it.
|
|
|
|
|
+ In the user control, you can simply declare two controls textbox and dropdownlist, and depending on which action is taken by the user, you can make the textbox/dropdownlist visible/invisible.
> Yeah, I thought of that... changed the code but it doesn't solve the problem - for the first 2 times the first item in the ddl remains selected (the SelectedItemChanged isn't called the first time the user picks another item).
+ In the web page, if you dynamically load the web user control, you can add it in the Page_Init, and depending on which radio button is selected, you can set a public property in the web user control which in turn controls the visibility of the TextBox and dropdownlist.
> Tried that one but then if I select something different in the ddl which is in it the first item is always selected.
+ Even simpler, you can declare the web user control right in the web page instead of dynamically loading it.
> No can do. I have about 50 user controls to choose from which depends on a dropdownlist (beside the radio buttons).. and each of the user controls is dependant on the radio buttons I mentioned above.
I guess that you dynamically add the user control to the web page on postback after the ViewState is loaded. IMO, you can do that in a simpler way:
> I have an event handler for each of the three radio buttons and in them I load the right user control and they determine if the textbox or ddl is visible or not. According to .NET event-handling code is always run after the viewstate is loaded, so yeah.
The problem remains unresolved... but thanx for answering..
|
|
|
|