|
Are you viray?
Well, the article shows you the way of using ADO.NET to save the image binary data to DB. Have you seen that? The article also gives you the sample code to pull the image from DB and display on the web page.
|
|
|
|
|
In an asp.net 2.0 GridView, as well as the fields from a database, there are columns for edit, select, delete.
How is it possible to enable/disable the columns such as edit or delete in the datagrid?
The reason I would like this is so that an Admin will be able to edit or delete but a normal uses will not be able to.
Thanks
|
|
|
|
|
In design mode, disable edit or delete column in your gridview. After that, in your code (in Page_Load), add these code:
protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack && userType == UserType.Admin)
{
//Enable Delete
CommandField deleteField = new CommandField();
deleteField.ShowDeleteButton = true;
this.GridView1.Columns.Insert(0, deleteField);
//Enable Edit
CommandField editField = new CommandField();
editField.ShowEditButton = true;
this.GridView1.Columns.Insert(0,editField);
}
}
Hope this help.
|
|
|
|
|
If you use the CommandField in the GridView control, then this field supports a couple of properties, for example ShowEditButton , ShowDeleteButton which you can use to set based on the user is currently accessing the web page. In addition, you can also use the TemplateField to contain the Edit/Delete button controls, and you simply set the Visible property of the controls depending on the user type. For more information, you can see MSDN[^]MSDN.
|
|
|
|
|
How about using something like
grid.column(5).visible=false based on the logged in user ?
Thanks
|
|
|
|
|
This way is also an option if you want to hide the entire column.
|
|
|
|
|
|
Hi
I am using StreamReader to read a text file. It works fine when I used to read file from my local system.
But when I mention a Text File's URL which resides on a Web Server then it does not accept path in URI form.
Please let me know how to read text file which does not resides on local machine
Thanks
Lets work it Out.........!
|
|
|
|
|
StramReader sreader = new StramReader(Server.Mappath(@"textfile.txt"));
|
|
|
|
|
Hello Friends,
I am really sorry for this stupid question. But I really have to solve this question:
I want to execute an INSERT command via my save button on my webform.
The procedure like below:
----------------------------------------------------------
string strSQL="INSERT INTO SupplierOperations VALUES (" +
txtOrderNum.Text + ",'" + txtModelNum.Text + "','" +
TextBox1.Text + "," +
.
.
.
.
-----------------------------------------------------------
How can I convert TextBox.Text value to SMALLDATETIME
I have tried Convert.ToDateTime(TextBox1.Text)....But did not work!!
I also copied this code part and tried to run it on to Sql Server Query analyzer and did not work..
Please help...really urgent situation
-- modified at 7:45 Thursday 11th May, 2006
|
|
|
|
|
"Did not work" is not sufficient to help you solve the problem. Post the code used, the error message any any other relevant information.
Current blacklist
svmilky - Extremely rude | FeRtoll - Rude personal emails | ironstrike1 - Rude & Obnoxious behaviour
|
|
|
|
|
First of all,I would like to tell thank you very much for your attention...
The problem is very clear I think..
INSERT INTO tbl1 VALUES
(........)
How can I convert the TextBox string to a SmallDateTime value?
|
|
|
|
|
string strSQL="INSERT INTO SupplierOperations VALUES ("
+ txtOrderNum.Text + ",'"
+ txtModelNum.Text + "','"
+ ddListVendor.SelectedItem.Text + "','"
+ DropDownList3.SelectedItem.Text + "','"
+ txtModelType.Text + "','"
+ txtModelExp.Text + "','"
+ ddlistGrup.SelectedItem.Text + "',"
+ Convert.ToDateTime(Textbox2.Text) + ","
+ Convert.ToDateTime(TextBox1.Text) + ","
+(TextBox6.Text) + ","
+ txtTerminDayCount.Text + ","
+ txtOKcount.Text + ","
+ txtConditionCount.Text + ","
+ txtStopCount.Text + ","
+ txtTotalCount.Text + ","
+ txtControlCount.Text + ","
+ txtMajor.Text + ")";
try
{
CollConnection.Open();
SqlCommand cmd=new SqlCommand(strSQL,CollConnection);
cmd.ExecuteNonQuery();
.
.
Enough??
|
|
|
|
|
hi
just try with this.
DateTime tempTime = Convert.ToDateTime(DateTime.Now.Tostring());
textbox1.text=tempTime.ToShortDateString();
and call this textbox1 in sql statement
Bhasker
|
|
|
|
|
Thank you very much for your attenton...But Unfortunately the result is not correct...
I really wonder is this really an IMPOSSIBLE question???
|
|
|
|
|
You really need to be using parameters instead of concatenated strings. Not only is it faster, but it's safer.
Since you only had 3 fields in your insert statement, that's all I put in this example
SqlConnection conn = new SqlConnection();
conn.ConnectionString = "Your_Connection_String_Here";
SqlCommand cmd = new SqlCommand();
cmd.Connection = conn;
cmd.CommandType = CommandType.Text;
cmd.CommandText = @"INSERT INTO [SupplierOperations ] VALUES (@orderNum, @modelNum, @other);";
SqlParameter p1 = new SqlParameter();
p1.SqlDbType = SqlDbType.NVarChar;
p1.ParameterName = "@orderNum";
p1.Value = txtOrderNum.Text;
SqlParameter p2 = new SqlParameter();
p2.SqlDbType = SqlDbType.NVarChar;
p2.ParameterName = "@modelNum";
p2.Value = txtModelNum.Text;
SqlParameter p3 = new SqlParameter();
p3.SqlDbType = SqlDbType.SmallDateTime;
p3.ParameterName = "@other";
p3.Value = TextBox1.Text;
cmd.Parameters.AddRange(new SqlParameter[] { p1, p2, p3 });
cmd.ExecuteNonQuery();
Found on Bash.org
[erno] hm. I've lost a machine.. literally _lost_. it responds to ping, it works completely, I just can't figure out where in my apartment it is.
-- modified at 13:11 Thursday 11th May, 2006
|
|
|
|
|
what should i do that the page(form) be not refresh when i click the button in asp.net(c#). my mean is: when i click the button the form the page moved and hurled or shot at first time for refreshing. the page move up and down first time and then be stop.
is it possible than it be stop like windows application?????????
|
|
|
|
|
what should i do that the page(form) be not refresh when i click the button in asp.net(c#). my mean is: when i click the button the form the page moved and hurled or shot at first time for refreshing. the page move up and down first time and then be stop.
is it possible than it be stop like windows application?????????
|
|
|
|
|
|
do you have sample code for smartNavigation? must assign to what object?
|
|
|
|
|
You can set the value SmartNavigation in the page directive of the aspx page.
Best Regards,
Apurva Kaushal
|
|
|
|
|
it's not object it is Property of Page.
In Load event of your application set as this
this.Page.SmartNavigation = true
But if you have any dynamic meny you have to be carefully because it deformation deynamic menu. In other boject works good like windowsapp.
|
|
|
|
|
when i used smartNavigation that is not diffrent and again my page refresh and .... and my menu be destroyed.
|
|
|
|
|
Hi,
I have a masterpage with some divisions and a placeholder in it. In that placeholder is an Iframe.
Now, I would like that Iframe to be as big as it needs to be. In Internet Explorer it works perfect. But in Firefox I have this tiny box with scrollbars.
How can I get the Iframe as big as it needs to be, in Firefox?
I managed to set the width of the Iframe with Jscript but somehow, the same doesn't apply to the heigth.
Code:
var currentfr=document.getElementById("ctl00_PlaceHolderPSAHNNIntranet_iFrameRunningApplication");currentfr.width = currentfr.contentDocument.body.offsetWidth; currentfr.width = eval(currentfr.width) + eval("16");
Help would be greatly appreciated.
|
|
|
|
|
I found this link at WebDeveloper which has a good discussion on your issue.
http://webdeveloper.com/forum/showthread.php?s=8c4c2466058beb5a1ae2c8be595c3524&t=85762"
Hope it helps!
|
|
|
|