|
yes u can do it by custom code.
dont use the update option of gridview. place a button in the page and in
button clik u can write sql query to insert values in each row to dbase by looping thru the rows in the gridview.. u can ,make use of SqlTransaction to insert all the records in a transaction.
foreach(GridviewRow gv in Gridview1.Rows)
{
// write code for inserting values into database from each row
}
CST
|
|
|
|
|
Ok, from there, how would you have that one field editable via a non-read only text box?
|
|
|
|
|
could u explain?? place textbox in templatefield of gridview. then u can edit..
CST
|
|
|
|
|
Yes sorry , I want the user to be able to make a bulk edit as it were. The gridview way that I know, you have to edit one row at a time by clicking the edit button. Is there a way to make all of the textboxes editable or will your suggestion work?
|
|
|
|
|
I am new to this .net, I need some help how to edit the gridview. I want to updata the data in the gridview
when I click the button in the gridview it is going back to the fornt page.
I want to do everything in the code manually.
Can some one help me on this?
<asp:GridView ID="GridView1" runat="server" AllowSorting="True" AutoGenerateColumns="False" AutoGenerateEditButton="True"
BackColor="White" BorderColor="#3366CC" BorderStyle="None" BorderWidth="1px"
CellPadding="4" ShowFooter="True">
<FooterStyle BackColor="#99CCCC" ForeColor="#003399" />
<RowStyle BackColor="White" ForeColor="#003399" />
<PagerStyle BackColor="#99CCCC" ForeColor="#003399" HorizontalAlign="Left" />
<SelectedRowStyle BackColor="#009999" Font-Bold="True" ForeColor="#CCFF99" />
<HeaderStyle BackColor="#003388" Font-Bold="True" ForeColor="#CCCCFF" />
<Columns>
<asp:BoundField DataField="PDate" HeaderText="Date" />
<asp:BoundField DataField="Time2" HeaderText="TimeIn" HtmlEncode="False" DataFormatString="{0:t}" />
<asp:BoundField DataField="TIN" HeaderText="In" />
<asp:BoundField DataField="Time1" HeaderText="TimeOUT" HtmlEncode="False" DataFormatString="{0:t}" />
<asp:BoundField DataField="TOUT" HeaderText="OUT" />
<asp:TemplateField HeaderText="Comments">
<ItemTemplate>
<asp:Label ID="Label2" runat="server" Text='<%# Bind("OutComm") %>'></asp:Label>
</ItemTemplate>
<FooterTemplate>
<asp:Label ID="Label7" Text="Total:" Font-Bold="True" Width="50" BorderStyle="Solid"
BorderWidth="0" Style="padding:2px; margin-top:5px" runat = "Server"/><br />
<asp:Label ID="Label4" Text="Overtime:" Font-Bold="True" Width="50" BorderStyle="Solid"
BorderWidth="0" Style="padding:2px; margin-top:5px" Runat="Server"/>
</FooterTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="TotalTime">
<ItemTemplate>
<asp:Label ID="Label3" Text='<%# FormatNumber(Get_Time(Eval("TotalTime"))) %>' Runat="Server"/>
</ItemTemplate>
<FooterTemplate>
<asp:Label id="TotalTime" Text='<%# FormatNumber(Get_Total_Time()) %>' Width="80" Runat="Server"
Font-Bold="True" BorderStyle="Solid" BorderWidth="1" BorderColor="#C0C0C0"
Style="padding:2px; margin-top:5px"/><br />
<asp:Label ID="Label5" Text='<%# FormatNumber(Get_Over_Time()) %>' Runat="Server"/>
</FooterTemplate>
<ItemStyle HorizontalAlign="Right" />
<FooterStyle BorderWidth="0px" Font-Bold="True" HorizontalAlign="Right" />
</asp:TemplateField>
</Columns>
</asp:GridView>
|
|
|
|
|
I have an System.Drawing.Bitmap object in memory that I have generated. I need to display this without writing the file to disk or uploading to a database somewhere. Normally I know I could write a binary stream using a Response object, but that is not available to me as I am doing this as a webpart, and all I have available is a HtmlTextWriter.
So I have a method like
<br />
public Bitmap createGraph() {<br />
}<br />
<br />
<br />
protected override void RenderChildren(HtmlTextWriter writer) {<br />
base.RenderChildren(writer);<br />
Bitmap graph = this.createGraph();<br />
}<br />
Thanks in advance.
|
|
|
|
|
The only way I know of, is to do a binary write, which only works if you set the mime type and all you send is the image ( not embedded in the page with other things )
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
I am displaying other elements on the page as well. Do you think the only way is to ship the Bitmap to a database as jpeg, and then read it back? Seems slow and counter intuitive to do it that way?
Ideas?
thanks
|
|
|
|
|
No, the only way is to have the image in your file system. So, your best bet is to store image paths in your DB instead of the jpeg data.
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
You can't do that. The browser will get the image in a separate request. You can't send it in the same request as the page.
---
single minded; short sighted; long gone;
|
|
|
|
|
Now I have spendt several days without finding a solution to my problem. I almost wish I still coded in ASP or PHP, this was easy in those languages. I have a product webpage where users can view product data for several products. And the users can aslo make changes to the selected product, change price, length and description. For selecting product I'm using a dropdownlist and a for saving data a submit button. As you see in the code below, I can't get the user entered data back from the page. The Page_Load event reload the textbox with data from the database on every reload of the page. Is it possible to construct a page that let me save the user entered data back to database, and not overwrite the text in the textbox on every reload? The code below is a simple, working version of my problem. The line "string sNewText = txtShort.Text;" should returne the userentered data, but it don't.
------------------------------ Design/Html-code ----------------------------------------
Choose product: <asp:dropdownlist id="ddlProductList" autopostback="true" runat="server">
Short text:
<asp:textbox id="txtShort" textmode="MultiLine" enableviewstate="true" runat="server">
<asp:button id="btnSave" runat="server" text="Lagre" onclick="btnSave_Click">
------------------------------ Code behind ----------------------------------------
protected void Page_Load(object sender, EventArgs e) {
int iIndex = 1;
if (ddlProductList.SelectedItem != null)
iIndex = Convert.ToInt32(ddlProductList.SelectedItem.Value);
if (!Page.IsPostBack) {
ddlProductList.DataSource = ProductManager.ProductsAll();
ddlProductList.DataTextField = "Title";
ddlProductList.DataValueField = "Id";
ddlProductList.SelectedIndex = iIndex - 1;
ddlProductList.DataBind();
}
Product productItem = ProductManager.ProductDetails(iIndex);
txtShort.Text = productItem.ShortText;
//txtShort.DataBind();
}
protected void btnSave_Click(object sender, EventArgs e) {
//string ret = Request.QueryString["txtShort"];
string sNewText = txtShort.Text;
}
Regards, Sigurd
|
|
|
|
|
You gave code to load the textbox in the Page_Load event which causes to lost the data. Is this the problem? Sorry if I misunderstood the problem
Thomas
|
|
|
|
|
sigurd friis wrote: txtShort.Text = productItem.ShortText;
You should only do this once, i.e. when !IsPostBack .
---
single minded; short sighted; long gone;
|
|
|
|
|
I found the solution for my problem. I had to move the code for reading the selected products data/text from database into the Dropdownlist's "selected(?)"-event.
|
|
|
|
|
Hi Guys and Gals.
I have an Access DB with pictures that's embedded into the table. I need to display this pictures now on an ASP web form using C#. I am using .NET 2005.
Can anyone maybe guide me in how to accomplish this or towards some code samples please.
Your help is greatly appreciated.
Regards,
Elizma
|
|
|
|
|
Elizma wrote: I have an Access DB with pictures that's embedded into the table. I need to display this pictures now on an ASP web form using C#. I am using .NET 2005.
Can anyone maybe guide me in how to accomplish this or towards some code samples please.
That is probably one of the most commonly asked questions. And bellow is the most frequently referenced link that answers the question:
http://www.stardeveloper.com/articles/display.html?article=2001040401&page=1[^]
Pete Soheil
DigiOz Multimedia
http://www.digioz.com
|
|
|
|
|
Hi,
My code looks follows for the asp:Wizard control:
<WizardSteps>
<asp:TemplatedWizardStep runat="server" ID="MyTemplatedWizardStep">
<ContentTemplate>
My Templated Wizard Step<br />
<br />
</ContentTemplate>
</asp:TemplatedWizardStep>
<asp:WizardStep ID="WizardStep3" runat="server" StepType="Complete">
Complete Wizard Step
<br /><br />
<asp:Label ID="Label1" runat="server"></asp:Label><br />
<br />
<asp:Label ID="Label2" runat="server"></asp:Label>
</asp:WizardStep>
</WizardSteps>
The button displayed on the TemplatedWizardStep page says "Finish". When I add my own own custom button in <CustomNavigationTemplate> then I am not sure what the CommandName property must be set to, because if I make it MoveNext then it doesn't function the finish button because I have an event handler with OnFinishButtonClick. It does not fire if I have my own button here.
Please can someone advise.
Thanks
|
|
|
|
|
I want to show a popup window on while clicking a link button .i want to pass the url of the popup window and also the id of each record while Databinding.the code which i used as follows.
Javascript as follows
function openWindow(url) {
window.open(url,'Calendar',
'width=500,height=400,left=200,top=250');
}
Link Button Postbackurl Code as follows
PostBackUrl="javascript:openWindow('<%# Concatcolumns("UserDetails.aspx?id=",DataBinder.Eval(Container.DataItem,"ID"))%>');">LinkButton
Concatcolumns Function as follows
public static string Concatcolumns(object obj1, object obj2)
{
return Convert.ToString(obj1) + Convert.ToString(obj2);
}
My Javascript code and Concatcolumns functions are correct only problem in my Postbackurl code.what is wrong in that.while page loading i want to bind each record id along with the popup window javascript.
|
|
|
|
|
Every thing seems ok. May be the PostBackUrl property makes the problem. Try an 'a' tag instead of LinkButton.
Thomas
|
|
|
|
|
What does the generated code look like?
Why do you concat the url using server code, when you can just as well put it in the markup code:
PostBackUrl="javascript:openWindow('UserDetails.aspx?id=<%# DataBinder.Eval(Container.DataItem,"ID") %>');"
---
single minded; short sighted; long gone;
|
|
|
|
|
How to maintain Scroll Position when press the Back button?
fttyhtrhyfytrytrysetyetytesystryrty
|
|
|
|
|
Check this one
this.Page.MaintainScrollPositionOnPostBack = true;
Thanks and Regards
Sandeep
If If you look at what you do not have in life, you don't have anything,
If you look at what you have in life, you have everything... "
|
|
|
|
|
hi friend's
i want to load a page in a window that opened by javascript
but my problem is that in the requested page i write code to determine the url of the requester page,but when i open a window by javascript i can't determine the url of the requester page,in the other word:the value of "Request.UrlReferrer.AbsoluteUri" is null.
what can i do ???
my really question is:
how can i load a page in a window that has not scrollbar or menubar and the width and heigth value is constant,and in addition i can determine the requester page on the requested page?
nobody help you...
you have to help you yourself
and this is success way.
|
|
|
|
|
When you use the window.open method, the requested page has no requester. If you would use a link with target="_blank", the requested page would have a requester, but then you can't control the appearence of the window.
In Javascript you can reach the parent window using window.opener , but you can't reach it directly from the server code.
Why do you need the url anyway? What are you going to use it for?
---
single minded; short sighted; long gone;
|
|
|
|
|
I have built ASP.NET 2.0 application using Visual studio 2005.
I created it as a website with Http type on IIS(Localhost)(not File system which VS 2005 defaultly creates website).
Say my application name is Website1:
Root is : http://localhost/Website1
I am using Frontpage to move my website from local to weserver.
Issue: Tried opening my local website1 by using root http://localhost/Website1.
It defaultly opens LocalHost as website and Never allowed me to open website1 folder as website.
But it gets moved as folder 'website1' from localhost to webserver.that doesnt work.
I also saw on my IIS Website1 is a website(not just a folder).
I cannot understand, whats going on.Is there some things to configure...
Any kind of help would be appreciated.
Thanks in advance
Mohamed
|
|
|
|