|
Hi everyone,
I'm very new to C# and ASP.NET. I am trying to create a dating site, where the user goes to a signup page, and they can enter info into the fields, but
how do I get that info passed over to the 2nd page, and then once they are done, save it in the database?
I know how to setup the database, and have a table setup with all the requirements but I haven't been able to find how to have the createprofile.aspx page pass that data correctly into the database?
Also, I want this page to then dynamically create a user profile page saved as an .html where the page dynimcally creates a member000001, member000002, and so on page.
Does anyone have any code that can do this??? I'm stuck.
|
|
|
|
|
Dear Programmers,
I am getting mad now to get what I want. I have searched 100 of articles but not found my desired one. I am using a gridview and want to give use a linkbutton as providing the option to the user to move the data of the rows of gridview up and down.
To give a better understanding I am giving you an example. I want that if user press the Up (LinkButton) Button on the gridview in second row than the data of second row will be shifted to first row and data of first row will be shifted to the second row. I am also giving you my code. In this I only want to get the indexposition or row position on which I am pressing the Up or Down Button. Please Help me to get rid of it otherwise I will be get mad because I am trying to get this from more than a week.
My code of gridivew is:
<asp:gridview id="dgUser" runat="server" autogeneratecolumns="False">
Width="400px" >
<columns>
<asp:templatefield headertext="Delete">
<itemtemplate>
<asp:checkbox id="chkDelete" runat="server">
<headerstyle font-bold="True">
<asp:templatefield headertext="HeadLine">
<itemtemplate>
<asp:textbox id="cgrid_headline" runat="server" enableviewstate="true" text="">]]>'>
<headerstyle font-bold="True">
<asp:templatefield>
<itemtemplate>
<asp:linkbutton id="lnkUp" runat="serveR" font-underline="True" forecolor="Blue" text="Up">
Visible="<%# IIf(CType(Container, GridViewRow).RowIndex = 0, false, true) %>" >
<asp:templatefield>
<itemtemplate>
<asp:linkbutton id="lnkDown" runat="serveR" font-underline="true" forecolor="blue" text="Down">
Visible='<%# IIf(CType(Container, GridViewRow).RowIndex =8, false, true) %>' >
Please friends help me. I will be thankful to all those in advance who will reply me.
Thankyou.
|
|
|
|
|
Although i haven`t worked with a scnerio as above , I once designed a page where the grid contains a dropdownlist and on its selection change i had to get its index. Following is the code...
ASPX Page
....
....
<Columns>
<asp:TemplateColumn HeaderText="Action">
<ItemTemplate>
<asp:DropDownList id="DDAction" runat="server" OnSelectedIndexChanged="DropDown_SelectedIndexChanged"
AutoPostBack="True"></asp:DropDownList>
</ItemTemplate>
</asp:TemplateColumn>
</Columns>
ASPX.CS
protected void DropDown_SelectedIndexChanged(object sender, EventArgs e)
{
DropDownList list = (DropDownList)sender;
TableCell cell = list.Parent as TableCell;
DataGridItem item = cell.Parent as DataGridItem;
i=item.ItemIndex;//you get the item index..
....
....
When you fail to plan, you are planning to fail.
|
|
|
|
|
Hi all,
I have a tricky problem here. I have a parent page from where i select a value in a DDL and pass it to a child page(new window) when user clicks a radio button.The child page contains a search functionality where the results are displayed in a grid view. The grid view contains a textbox as a template column where the user enters some value. When the user clicks Save button i need to save the details entered by user in a dataset(not a problem)..
But also on save i have to close the current window and display the results in parent page. Is there a way i can call an event of parent page to display the datagrid with a click event in child page????
Thanks in advance.....Any help would be appreciated....
When you fail to plan, you are planning to fail.
|
|
|
|
|
Yeah there is. Redirect the parent page via javascript. You can pass any value from the child window via query string or session.
//Javascript
function closeMe(loc)
{
if (opener && !opener.closed) opener.location.href = loc;
window.close();
}
// C#
this.Page.RegisterClientScriptBlock("key", @"closeMe('http://www.google.com? + put your parameters here');");
I didn't get any requirements for the signature
|
|
|
|
|
Hi,
I am a beginner in aspx with c#. Pls check the link below
------------------------------------------------------------------
http://www.codeproject.com/KB/selection/MonthCalendar.aspx?fid=194080&df=90&mpp=25&noise=3&sort=Position&view=Quick&fr=351#xx0xx[^]
---------------------------------------------------------------------
The last fifteen days i searched this type of calendar control. Really its excellent. But i do not know how to use this control in VS2005. Can anyone explain step by step to use this control in VS2005? In advance thanks alot.
|
|
|
|
|
This is a windows control. You wont be able to use it in your web application.
*jaans
|
|
|
|
|
To use a calendar control in ASP.NET, it needs to be written in javascript. Google, there are tons of them out there.
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Hi
I have the following hyperlinkfield:
<asp:hyperlinkfield datanavigateurlfields="Item_Ref, Item_Description" datatextfield="Item_Ref" headertext="Item_Ref" sortexpression="Item_Ref" datanavigateurlformatstring="~/Main/RoomCompdets.aspx?firstvar={0}" target="_new">
how would i add in some code which would open the new window to a certain size thanks
|
|
|
|
|
Go through the following page..
Using the window.open method[^]
Please search over the net to find some resources before posting questions.
*jaans
|
|
|
|
|
thanks for the reply
although it is annoying when people assume i havent done my research before i post even though I have
The problem Ive got is that i have a hyperlinkfield which i cant put an onclick event into therefore it makes my original question a bit more tricky as where on earth do i put the javascript to set the new window to a certain size
thats the problem i have
|
|
|
|
|
a-+s-+p-+ wrote: i have a hyperlinkfield which i cant put an onclick event into
Have you tried some thing like
YourControlName.Attributes.Add("onclick",<br />
"window.open('page2.aspx','mywindow','status=1');"); ?
*jaans
|
|
|
|
|
yep because i have to sepcifit inside the gridview the exact column i.e. gridview.columns[1] it wont work
thanks anyway
|
|
|
|
|
|
Hi all
iam developing a search page where the user can enter and select from different dropdownlists to construct the select statement. The user can add several rows(search criteria). I want to maintain the criteria the users chooses, lets say he selects first criteria and second or third. To save the criteria i have inserted a grid and what i want is to insert to this grid as rows. Each time the user chooses criteria he presses Add and this criteria is saved temporarly in the grid so i can upon pressing search to collect all criteria in one big select statement and do the search. How can i insert/delete to this grid?
|
|
|
|
|
You can save a DataTable in viewstate. Add a new row to your Datatable and then rebind the grid.
I didn't get any requirements for the signature
|
|
|
|
|
Hi
I would like to pass a variable from a gridview hyperlink to the next page
how woudl i do this
thanks
|
|
|
|
|
You can pass it in querystring.
please don't forget to vote on the post that helped you.
|
|
|
|
|
i have the following code
it displays the variable in the browser but no data is displaying
Page1:
asp:HyperLinkField DataNavigateUrlFields="Item_Ref" DataTextField="Item_Ref" HeaderText="Link" SortExpression="Item_Ref" DataNavigateUrlFormatString="~/Main/RoomCompdets.aspx?firstvar={0}" Target="_blank" />
Page 2
<asp:sqldatasource id="SqlDataSource1" runat="server" connectionstring="">]]>" SelectCommand="SELECT [ADB_Ref] FROM [item_descriptions] WHERE ([ADB_Ref] = @FirstVar)">
<selectparameters>
<asp:sessionparameter name="Firstvar" sessionfield="firstvar">
<asp:gridview id="GridView4" alternatingrowstyle-forecolor="black" rowstyle-forecolor="black" alternatingrowstyle-font-size="Large" runat="server" allowpaging="True" autogeneratecolumns="False" datasourceid="SqlDataSource1">
<columns> <asp:boundfield datafield="ADB_Ref" visible="true" headertext="ADB_Ref">
any help would be great
thanks
|
|
|
|
|
|
Hello Genious..
I have some word files on server.. that i need to download all of them together..
So i have only one option that first i create a zip file from all these files and then then download this zip file..
So my functionality achived.
But when i extract these zip file and opens word any of word files within downloaded zip file, Opened Word file shows only byte data means some thing like lots of Sqaures which may be same as bytes of files..
and obeviously word file should display actual content in readable character..
Any Suggestons will appreciated...
If needed the please refer to my code..
For i As Integer = 0 To strFileToDownload.Count - 1
Dim strFileName As String = Path.GetFileName(strFileToDownload(i))
Dim MyFileStream As FileStream = File.OpenRead(strFileToDownload(i))
Dim buff() As Byte = New Byte((MyFileStream.Length)) {}
'Dim zipEntry As New ZipEntry(strFileToDownload(i))
Dim zipEntry As New ZipEntry(strFileName)
zipOS.PutNextEntry(zipEntry)
zipOS.Write(buff, 0, buff.Length)
zipOS.InitializeLifetimeService()
MyFileStream.Close()
Next
' Compress and close the zip file
zipOS.Finish()
zipOS.Close()
Response.ClearContent()
Response.ClearHeaders()
Response.ContentType = "application/zip"
Response.AddHeader("Content-Disposition", "attachment; filename=" + "CMM " + strProjectSize + " size Project Documents" + System.IO.Path.GetFileName(strNow))
Response.WriteFile(strNow)
Response.Flush()
Response.Clear()
|
|
|
|
|
I can sort a column on the first page,but when i go to second page through paging sorting changed it's order.
Another problem is When i click Edit button,sorting is changed as a result data are also changed for which i can't edit the actual row rather i see a different data on the same row to be updated.
Here is my code...
<asp:GridView ID="GridView1" runat="server" AllowPaging="True" AllowSorting="True"
OnPageIndexChanging="pagemethod" OnSorting="sortmethod" OnRowEditing="editmethod"
AutoGenerateColumns="False" PageSize="4" >
<Columns>
<asp:CommandField HeaderText="Edit" ShowEditButton="True" ButtonType="Button" />
<asp:TemplateField HeaderText="Name" SortExpression="Name">
<ItemTemplate><%#Eval("Name")%></ItemTemplate>
<EditItemTemplate>
<asp:TextBox ID="txtname" runat="server" Text='<%# Eval("Name") %>'></asp:TextBox>
</EditItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
BindGridView();
}
}
public void BindGridView()
{
DataSet ds = new DataSet();
ds=binddata();
GridView1.DataSource = ds;
GridView1.DataBind();
}
public DataSet binddata()
{
SqlConnection con = new SqlConnection("Server=.;database=emp;uid=sa;pwd=;");
SqlDataAdapter da = new SqlDataAdapter("select * from job", con);
con.Open();
DataSet ds = new DataSet();
da.Fill(ds, "emp");
return ds;
}
public void sortmethod(object sender, GridViewSortEventArgs e)
{
ViewState["sortcolumn"] = e.SortExpression;
if (ViewState["sortorder"] == null)
{
ViewState["sortorder"] = "asc";
}
ViewState["sortorder"]=ViewState["sortorder"].ToString() == "asc"?"desc":"asc";
DataView dv = new DataView(binddata().Tables[0]);
dv.Sort = ViewState["sortcolumn"] + " " + ViewState["sortorder"];
GridView1.DataSource = dv;
GridView1.DataBind();
}
public void pagemethod(object sender, GridViewPageEventArgs e)
{
GridView1.PageIndex = e.NewPageIndex;
GridView1.EditIndex = -1;
BindGridView();
}
public void editmethod(object sender, GridViewEditEventArgs e)
{
GridView1.EditIndex = e.NewEditIndex;
BindGridView();
}
|
|
|
|
|
try this code<br />
protected void Page_Load(object sender, EventArgs e)<br />
<br />
{<br />
if (!IsPostBack)<br />
{<br />
BindGridView();<br />
}<br />
<br />
}<br />
<br />
public void BindGridView()<br />
<br />
{<br />
DataSet ds = new DataSet();<br />
ds=binddata();<br />
DataView dv = new DataView(ds.Tables[0]);<br />
if(ViewState["sortcolumn"] != null && ViewState["sortorder"] !=null)<br />
{<br />
dv.Sort = ViewState["sortcolumn"] + " " + ViewState["sortorder"];<br />
}<br />
GridView1.DataSource = dv;<br />
GridView1.DataBind();<br />
<br />
}<br />
<br />
public DataSet binddata()<br />
<br />
{<br />
SqlConnection con = new SqlConnection("Server=.;database=emp;uid=sa;pwd=;");<br />
SqlDataAdapter da = new SqlDataAdapter("select * from job", con);<br />
con.Open();<br />
DataSet ds = new DataSet();<br />
da.Fill(ds, "emp");<br />
return ds;<br />
}<br />
<br />
<br />
<br />
public void sortmethod(object sender, GridViewSortEventArgs e)<br />
<br />
{<br />
ViewState["sortcolumn"] = e.SortExpression;<br />
<br />
if (ViewState["sortorder"] == null)<br />
{<br />
ViewState["sortorder"] = "asc";<br />
}<br />
ViewState["sortorder"]=ViewState["sortorder"].ToString() == "asc"?"desc":"asc";<br />
BindGridView();<br />
}<br />
<br />
<br />
public void pagemethod(object sender, GridViewPageEventArgs e)<br />
<br />
{<br />
GridView1.PageIndex = e.NewPageIndex;<br />
GridView1.EditIndex = -1;<br />
BindGridView();<br />
<br />
}<br />
<br />
public void editmethod(object sender, GridViewEditEventArgs e)<br />
<br />
{<br />
GridView1.EditIndex = e.NewEditIndex;<br />
BindGridView();<br />
<br />
<br />
}
please don't forget to vote on the post that helped you.
|
|
|
|
|
Hello
Can anybody let me know how to do Edit,Update and Insert in DetailsView programatically.
Wafy
|
|
|
|
|