|
Thanks for the info! That's what I needed.
If my answer has helped you, one of my articles may also be a help. Also remember that your best friend's name is google.
|
|
|
|
|
Glad you found it useful but please remember to rate the response appropriately.
only two letters away from being an asset
|
|
|
|
|
Richard Blythe wrote: The "Sign Up" functionality consists of:
* txtEmailAddress,
* RequiredFieldValidator for txtEmailAddress
* btnSignUp
Now when btnSignUp is clicked, the RequiredFieldValidator for txtComments will not allow the page to postback!
You need to create the ValidationGroup for it. RequiredFieldValidator for txtEmailAddress , txtEmailAddress and btnSignUp should be under same validation group.
|
|
|
|
|
Hi,
I am doing forum project. I have a doubt, tat how to count the value. that is, all the data which displays in gridview. in tat i need to show the reply value [count the value from database].it means in database i hv field lke pid,pstreplyid,uid,tit,sub ...., in tat wen i create new msg it ll save in database giving pid automaticaly and in pstreplyid if its newmsg it creates 0 if its reply ten it takes pid value.
in gridview what i wud lke to display is, the reply value, if the pid(2) has 3 reply means, the field of reply shud show 3.
but i hv given query which displays only the new msg tat is pstreplyid=0.
i need to display new msg at the same time it should display the replyvalue also.
but i dnt knw how to count tat value so pls help me to do.
you just give me the suggestion to overcome the issue.
this is the gridview coding
============================
page load()
{
string k = "select *,(select uname from login where login.uid=thread.uid)as uname from thread where pstreplyid=0";
adp = new SqlDataAdapter(k, con);
DataSet ds = new DataSet();
adp.Fill(ds);
GridView1.DataSource = ds;
GridView1.DataBind();
}
HTML
====
<asp:TemplateField HeaderText="Thread">
<EditItemTemplate>
<asp:TextBox ID="TextBox1" runat="server" Text='<%# Bind("tit") %>'></asp:TextBox>
</EditItemTemplate>
<ItemTemplate>
<
<asp:LinkButton ID="LinkButton1" runat="server" Text='<% # Eval("tit") %>' CommandName ="viewmsg" CommandArgument ='<%# DataBinder.Eval(Container.DataItem,"pid")%>' >LinkButton</asp:LinkButton>
<br />
<%#Eval("sub") %>
</ItemTemplate>
<asp:BoundField HeaderText="Replies" DataField="pstreplyid"/>
<asp:BoundField DataField="pdate" HeaderText="Post Date" />
<asp:BoundField DataField="rdate" HeaderText="Reply Date" />
<asp:TemplateField HeaderText="Posted By">
Thank you in advance.
k.priya
modified on Sunday, August 9, 2009 12:08 PM
|
|
|
|
|
priyamsc wrote: how to count the value. that is, all the data which displays in gridview
Try out ds.Tables[0].Rows.Count..(just check the syntax )
|
|
|
|
|
could you say little bit clearly
k.priya
|
|
|
|
|
I think, you can get the count of rows which you are looking for.
ds.Tables[0].Rows.Count would give you the count of rows.
Let me know if you are looking for something else.
|
|
|
|
|
can i get rowindex of paricular row in a table
|
|
|
|
|
amarnath n.n wrote: can i get rowindex of paricular row in a table
which kind of table ? Are you talking about GridView or what ?
|
|
|
|
|
|
sorry wrongly sent
Table in a DataSet
|
|
|
|
|
amarnath n.n wrote: Table in a DataSet
Yes you can. Load the DataSet Table data in DataTable . Then you can read the data from each and every row based on row index.
DataSet Ds= LoadDataSet();
if (Ds.Tables["Table1"].Rows.Count>0)
{
DataTable dtable = new DataTable();
dtable = Ds.Tables["Table1"];
string Name= dt1.Rows[0]["Name"].ToString();
}
This is an sample example, Hope this will help you
|
|
|
|
|
Not like this i want to get the rowindex of particular row.see the code which i am trying to do that
DataRow[] row =dsphotos.Tables[0].Select("PHOTO_ID",Session["ID"].ToString());
int rowindex= dsphotos.Tables[0].Rows.IndexOf(row[0]);
|
|
|
|
|
So what's your question? You are fine with your implementation or you want something else.
|
|
|
|
|
How to pass an array from asp.net aspx.cs page go javascript function
|
|
|
|
|
amarnath n.n wrote: How to pass an array from asp.net aspx.cs page go javascript function
Check your last post, many members are answered on the same.
Your last post [^]
|
|
|
|
|
Hello Is there a way to retrieve text from datalist
thanks alot
|
|
|
|
|
|
Thanks for the answer but I mean the text inserted without any control..
Thanks.
|
|
|
|
|
You can't insert text without a control. What DataList are you talking about?
only two letters away from being an asset
|
|
|
|
|
Dear All,
I have a page holding data in data list. I created paging option for datalist with dynamic link buttons created during-page pre init event. It runs if(!Ispostback).
Then I hold number of pages in session in order not to connect to database in each page refresh.
Then I have dropdown list accorging to which the number of pages changes. So the number of link buttons also should change with selection.
However when I clicked on the button page-preinit creates the link buttons before the it handles click event, therefore creates the link buttons according to the number hold in session, in other words according to previous page number..
Here are the codes
protected void page_Preinit(object sender, EventArgs e)
{
if (!IsPostBack)
{
getpagecount("0","0","0"); // gets the page count form database.
}
else { lb_Count = int.Parse(Session["Page"].ToString()); } //gets the figure in the session.
for (int i = 1; i <= lb_Count; i++)
{
LinkButton bottomLink = new LinkButton();
LiteralControl bottomLiteral = new LiteralControl(" ");
bottomLink.Text = i.ToString();
pnlBottom.Controls.Add(bottomLink);
pnlBottom.Controls.Add(bottomLiteral);
bottomLink.Click += new EventHandler(this.changeLink);
}
if (con!=null && con.State == ConnectionState.Open)
{
con.Close();
cmd.Dispose();
}
}
HERE IS THE CLICKED EVENT
protected void btnYemekler_Click(object sender, ImageClickEventArgs e)
{
//HERE, THE PAGE NUMBER IN SESSION CHANGES BUT THE LINK BUTTOS ARE ALREADY CREATED.
getpagecount(DlAscilar.SelectedValue.ToString(),
DlMutfaklar.SelectedValue.ToString(), DlBolgeler.SelectedValue.ToString());
doldur(DlAscilar.SelectedValue.ToString(),
DlMutfaklar.SelectedValue.ToString(), DlBolgeler.SelectedValue.ToString());
dlListe_Doldur(0);
}
WHAT CAN I DO TO HANDLE THIS PROBLEM.
THANKS IN ADVANCE
|
|
|
|
|
My answer may/may not be dirty, but that would work.
1. Place a Server-Side HiddenField in the *.aspx file.
2. Handle the OnClientClick event (JavaScript) of the Button.
3. OnClientClick you have to set the page number or whatever data you want into the HiddenField.
4. After the OnClientClick event, Button's Click process will start.
5. Now in your Page_PreInit get the values of the HiddenField and continue your routine process.
6. Here you can get rid of Session object.
Let me know if you have questions. Please mark it as answer if it helps you.
|
|
|
|
|
I marked it Thanks alot.
|
|
|
|
|
Hello,
When I add a TemplateField to GridView it is alwasy my first field by default.
How can I change the order?
|
|
|
|
|