|
Seeing that this is posted under asp.net i will give you a client side solution in "jQuery":
<div id="divWithTextBoxes">
<input class="text-boxes" runat="server" type="text" />
</div>
<input id="btnGenerateTxtBoxes" runat="server" type="button" onclick="GenerateTextBoxes( $('#divWithTextBoxes') );" />
function GenerateTextBoxes( sender )
{
var txtBoxHtml = '<input class="text-boxes" runat="server" type="text" />';
sender.append( txtBoxHtml );
}
To make it easier for you, i added a css class (text-boxes) that you can later use to retrieve the values of your textboxes if need be and below is how you can achieve that using "jQuery":
function GetTextBoxValues()
{
var arrayOfValues = [];
$( '.text-boxes' ).each( function(){
if( $(this).val() != '' )
{
arrayOfValues.push( $(this).val() );
}
});
}
Hope that helps,
Morgs
|
|
|
|
|
now I need to request one thing,
in my database table, there is date column as datatime value.
I want to generate using the year of this 'date' column.
for example , I want to do like below:
id | name | date | caseID
1 | Peter | 12/1/2011 12:00:00 AM | 201100001
2 | Willam | 12/2/2011 12:00:00 AM | 201100002
3 | Willam | 12/3/2011 12:00:00 AM | 201100003
4 | Alex | 1/1/2012 12:00:00 AM | 201200001
5 | Willam | 2/2/2013 12:00:00 AM | 201300001
in this table,
in 'caseID' column, I want to generate like above..
for year 2011,
201100001 // (2011(year) + 00001)
201100002 //(2011(year) + 00002)
....
201100010 //(2011(year) + 00010)
When reached year 2012, I want to auto start from 00001 like that:
201200001
201200002
...and so on.
please help me how I have to do for caseID column in my example table.
thanks all.
how I have to pass year parameter value & how I have to create user defined function. please
|
|
|
|
|
|
|
|
Are you talking about this.
It uses System.IO.Compression
|
|
|
|
|
Kindly note that I am starting to learn ASP.NET4 thus the way I am wording my question might not be good.
Anyway, I would like to display all the records retrieved from a database via a data reader. At this moment I am simply doing it as follows:
. . .
. . .
SqlDataReader reader = cmd.ExecuteReader();
// Display the records on generic gridview.
grdvEmail.DataSource = reader;
grdvEmail.DataBind();
reader.Close();
And grdvEmail is very basic one thus for my output I simply get the following basic display:
ID LastName FirstName EmailAddress
71 Chan Jackie food@bluegarden.com
72 Kuzi Joseph food@goldengate.com
73 Kuzii John foods@goldengate.com
.
.
.
95 Zeta Kyle fuzzy@share.com.com
How could I make the display in such a way that I can scroll down and up the available list, and then one a row is currently highlighted or selected, if I select an Edit button that is located below the current display, a new form containing the detail record for the currently selected or hihglighted row will be displayed.
Kindly note that the header texts have to be changed also.
It does not have to be gridview to do the display. I know this is a very basic question, but once I know how to do simple things like this learning and doing work with ASP.NET 4 will be easier for me because I understand already know how to do the database programming.
Any better suggestion? I do not know whether I have to use ObjectDataSource to do a better display. Thanks.
|
|
|
|
|
You need to add some sort of trigger or button, and double click on it to wire up a command function.
in the command function, as the control for the selected value
if page.ispostback
dim iValue as Integer
iValue = controlName.SelectedValue
if iValue > 0 Then
|
|
|
|
|
Thank you for your reply. After doing some changes, my new questions now are the ones shown on the message below. Please let me know your suggestions.
|
|
|
|
|
Hi,
For displaying scroll bar in grid view you can use an asp:panel.
<asp:panel id="pnlGrid" runat="server" <b="">Scrollbars="Vertical"/>
On The Edit button click you can use another panel and show it when you edit a grid view row.
This panel would consists of text boxes which would display the selected row's details in brief.
You can use grid view rowcommand event for displaying details of the selected row
<asp:templatefield headertext="ID">
<itemtemplate>
<asp:linkbutton id="lnkbtnEdit" runat="server" commandargument="<%#Eval("ID")%>" commandname="Select">
Note:Eval is a databinding expression.
You can maintain the datasource in session
and filter values in datasource based upon the command argument.
protected void GridView_RowCommand(object sender, GridViewCommandEventArgs e)
{
if(e.CommandName=="Select")
{
string ID=Convert.ToString(e.CommandArgument.ToString());
DataView gridviewData=(DataView)this.Session["DS"];
DataRow[] selectedRow = gridviewData.Table.Select("ID=" + ID);
if (selectedRow[0] != null)
{
DataRowW currRow=selectedRow[0];
txtEmailadd.text=currRow["EmailAdd"].tostring();
}
}
}
<div class="signature">Cheers
SyedMuneem</div>
|
|
|
|
|
![Go to Parent](https://www.codeproject.com/App_Themes/CodeProject/Img/arrow-up24.png) Hello, SyedMuneem.
My current code is shown below. I could see the vertical scrollbar in case there are many corresponding records to be display. My other questions now are:
(1)When I scroll up or down, the very first header line moves up or down also. How do I make the very first header line fixed?
(2)The very last column, the PersonSeq, if I click, I am actually displaying another form from which I can edit the various fields that can be edited.
What I would like to do finally is get rid or hide that PersonSeq column and be able to click on or select any row just like any row in a scrollable textbox.
And once I have clicked on or selected any row, if I would like to edit that currently selected row, I would just click one "EDIT" button at the very bottom of the panel(?) and then that is when I would like to call that separate form for editing the details of that selected. How do I do this, and how do I pick up the PersonSeq of the row/record that I clicked (or selected) on so I could pass it to that separate form for editing. The point is I do not want to use the gridview's provided edit/select buttons that are on each row or record of the gridview.
<asp:Panel ID="Panel1" runat="server" ScrollBars="Auto" Width="100%" Height="350px">
<asp:GridView ID="gridViewPersonInfo" runat="server" AutoGenerateColumns="False"
CellPadding="4" ForeColor="#333333" GridLines="None"
onselectedindexchanged="gridViewPersonInfo_SelectedIndexChanged">
<AlternatingRowStyle BackColor="White" ForeColor="#284775" />
<Columns>
<asp:BoundField DataField="EmailAddress" HeaderText="Email Address" />
<asp:BoundField DataField="LastName" HeaderText="Last Name" ReadOnly="True" />
<asp:BoundField DataField="FirstName" HeaderText="First Name" ReadOnly="True" />
<asp:ButtonField CommandName="Select" DataTextField="PersonSeq"
HeaderText="Person Seq" Text="Button" />
</Columns>
<EditRowStyle BackColor="#999999" />
<FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
<HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
<PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center" />
<RowStyle BackColor="#F7F6F3" ForeColor="#333333" />
<SelectedRowStyle BackColor="#E2DED6" Font-Bold="True" ForeColor="#333333" />
<SortedAscendingCellStyle BackColor="#E9E7E2" />
<SortedAscendingHeaderStyle BackColor="#506C8C" />
<SortedDescendingCellStyle BackColor="#FFFDF8" />
<SortedDescendingHeaderStyle BackColor="#6F8DAE" />
</asp:GridView>
</asp:Panel>
|
|
|
|
|
Would love to help, but I don't do gridview questions.
|
|
|
|
|
Hi
I have a field in database that contain both text and image I want to display this field in gridview please help me.
![Confused | :confused:](https://codeproject.global.ssl.fastly.net/script/Forums/Images/smiley_confused.gif)
|
|
|
|
|
|
In This case that you mention you have a field that only contain picture but I have one field that contain picture and text like this "This is test as an example" when I bound it to gridview it doesn't show me the image and gridview treat with this case like a text so what can I do to solve it?
|
|
|
|
|
actually, i'm using updatepanel at my asp.net page because i need the partial refreshing at my page.
my page including 3 parts. at the first it just shows the top menu, once user clicks on any of the top menu it will shows the left sub menu and by clicking on any of the sub menu it will shows the content of the sub menu, which is including table with add, edit, delete and insert button. for the table i have used the listview.
Now i want to show one external page at the 3rd panel, which means when the user click on the sub menu the 3rd panel load the another page. for example my page name is default.aspx and once the user click on the sub menu at the default.aspx page it shows the Product.aspx page at the 3rd panel. i don't want to use the iframe and i have gone through uframe at the http://uframe.codeplex.com and http://www.codeproject.com/KB/aspnet/uframe.aspx but i couldn't use the uframe at my page.
Could you please guide me how to use uframe at my page or any other way to load the other page at the 3rd panel of my default.aspx.
appreciate your consideration.
|
|
|
|
|
If you need help with something from codeplex you should ask there.
You could use JQuery load to get the other page but there may be good deal of work necessary to extract the actual content you want rendered. Iframe would be the best implementation.
No comment
|
|
|
|
|
i have done a web page but i have a problem...i already make a waveform graph and the buttons to control the graph in different window...my problem now is i want to make the buttons to control the graph and the graph in the same window... i try to make it in the same window but i can not refresh the graph...anyone can help me to solve my problem?i want the graph always refresh and the button still have in the window and do not refresh with the graph....
|
|
|
|
|
Pick one forum and use it don't post the same question multiple times
No comment
|
|
|
|
|
I'm trying to reference the attributes of a panel in a User Control in the code behind of a web page. I've tried about a dozen variations. Can't be this hard. Anybody got the correct syntax? Thanks!
<%@ Register Src="~/inc/ceSteps.ascx" TagName="ceSteps" TagPrefix="uc1" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server"></asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
<uc1:ceSteps ID="ceSteps" runat="server" />
Then in the page's code behind, here's where I get stuck.
Dim myCtrl As UserControl = CType(FindControl("uc1"), UserControl)
myCtrl.pnlStage1.BackColor = System.Drawing.ColorTranslator.FromHtml("#dfdfdf")
yahda, yahda, yahda....
|
|
|
|
|
The register is the webform side of the dll.
<uc1:sample>
The code side is something like, ceSteps is the class name assigned to the program code you want to access.
Dim myCtrl As ceSteps = new ceSteps
ceSteps myCtrl = new ceSteps;
ceSteps *myCtrl = new ceSteps;
|
|
|
|
|
I kinda get what you're saying and I tried it, but it won't let me reference the class ceSteps as a namespace like I do when I import at the top of the page (say for my login code) and then reference an instance of a namespace. I've used the code below before in another app, honest, but it's not working and I'm stumped.
Dim myPnl As Panel = CType(CType(FindControl("ceSteps"), UserControl).FindControl("pnlStage1"), Panel)
myPnl.BackColor = System.Drawing.ColorTranslator.FromHtml("#dfdfdf")
|
|
|
|
|
I also thought it might be because I was missing the reference through the master/content relationship, but that wasn't it:
Dim myConPH As ContentPlaceHolder
myConPH = CType(FindControl("SSLmaster_ContentPlaceHolder1"), ContentPlaceHolder)
Dim myPnl As Panel = CType(CType(myConPH.FindControl("ceSteps"), UserControl).FindControl("pnlStage1"), Panel)
|
|
|
|
|
I wasn't able to see your user control.
With user controls, like server controls, you don't use the code behind pages on the webform to interact with them. Instead, you write more code in your user control.
So just register the control in the webform like you did. Then if you want to do something in page.load, you add an override to your user control.
Public Class MyControl
Private lbl_Website_Name As Label
Protected overrides Sub OnInit(ByVal e as System.EventArgs)
controls.clear
lbl_WebsiteName = New Label
With lbl_Website_Name
End With
Controls.Add(lbl_Website_name)
End Sub
Protected overrides Sub OnLoad(ByVal e As System.EventArgs)
Do you stuff.
lbl_Website_Name.txt = sWebsiteName
End Sub
This will append to the current page.load on the web form, and operate identical to page load.
You can call the control by the name assigned,
|
|
|
|
|
![Go to Parent](https://www.codeproject.com/App_Themes/CodeProject/Img/arrow-up24.png) Sorry, that won't work for me - I need to do so from the child webpage. Let me try and be a little more precise, maybe that will help. I really think it's something to do with master/child since I was able to successfully reference one when not using the master.
Master:
<%@ Master Language="VB" CodeFile="SSLmaster.master.vb" Inherits="master" EnableTheming="true" %>
<body>
<form id="form1" runat="server" enableviewstate="true"><asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager>
<asp:ContentPlaceHolder id="ContentPlaceHolder1" runat="server"></asp:ContentPlaceHolder>
yahda, yahda, yahda...
Child:
<%@ Page Title="yahda" Theme="SSL" Language="VB" MasterPageFile="~/inc/SSLmaster.master" AutoEventWireup="false" CodeFile="zdetail1.aspx.vb" Inherits="calendar_zdetail1" %>
<%@ Register Src="~/inc/ceSteps.ascx" TagName="ceSteps" TagPrefix="uc1" %>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
UserControl:
<%@ Control Language="VB" AutoEventWireup="false" CodeFile="ceSteps.ascx.vb" Inherits="inc_ceSteps" %>
<asp:Panel runat="server" ID="Panel1" > Step 1 </asp:Panel>
CodeBehind of Child:
First Stab (successful on page without Master):
Dim myPnl As Panel = CType(CType(FindControl("ceSteps"), UserControl).FindControl("pnlStage1"), Panel)
myPnl.BackColor = System.Drawing.ColorTranslator.FromHtml("#dfdfdf")
Second Stab (and many more variations)
Dim myConPH As ContentPlaceHolder
myConPH = CType(FindControl("SSLmaster_ContentPlaceHolder1"), ContentPlaceHolder)
Dim myPnl As Panel = CType(CType(myConPH.FindControl("ceSteps"), UserControl).FindControl("Panel1"), Panel)
myPnl.BackColor = System.Drawing.ColorTranslator.FromHtml("#dfdfdf")
|
|
|
|