|
I have two tables both containing 3 columns each. In first table there were 3 columns(c1,c2,c3) and in second table there were 3 columns(b1, b2, b3). Now i have to display in gridview. But i want display only 2 columns i.e., c1 from first table and b2 from second column. How can i do that?
|
|
|
|
|
It should be simple, one possible solution could be write some wrapper class with two fields having compatible types to corrosponding database columns. For example
public class MyWraper
{
private string _column1
public string Column1
{
get{return _column1;}
set{_column1 = value}
}
private string _column2
public string Column2
{
get{return _column2;}
set{_column2 = value}
}
}
Now write some query that return data from both tables. Now depending upon those columns returned by query create for each record create a new wrapper object, populate its data from respective column values and finally add it some list. Now finally bind your grid to that list.
List<MyWraper> myList = new List<MyWraper>;
while(dataReader.Read())
{
MyWraper w = new MyWraper();
w.Column1 = dataReader["C1"].ToString();
w.Column2 = dataReader["C2"].ToString();
myList.Add(w);
}
gridView1.DataSource = myList;
gridView1.DataBind();
|
|
|
|
|
I am tried this. But i am not able to use the list it is giving error. Please help me. Which is the namespace i have to add so that i can use list.
|
|
|
|
|
hello every one
I work a special site for Real Estate
It is the services provided the service of the search for real estate and certain specifications such as the type of property to be either Villa or apartment number of floors neighborhood ....
So I need a search within the databases
How do I write a research and search data entered by the user who used a graphical user interface containing the by dropdwonlist and check box
plz help me
|
|
|
|
|
First of all create your UI and place desired control for example dropdown for selecting property type etc. In order to implement search function you would need to build query on runtime depending upon values selected by user. For example let say there is a table having 4 columns id,name,gender,age and you need to build some page where user can filter users upon age and gender.
Suppose you placed a dropdown box with two values Male,Female and a text box to enter the age, a button with caption filter to trigger filter and finally a grid view for showing filtered data. Now write a function that takes two parameters gender and age and returns matched customer records for example
public DataTable FilterUsers(string gender,int age)
{
string selectQuery = "SELECT * FROM c_Users WHERE Gender ='{0}' AND Age={1} ";
selectQuery = string.Format(selectQuery,gender,age);
//Code here to execute query
//finally return the returned data table with resutls
}
|
|
|
|
|
Hi all,
I want to Store All Textbox id's of Current Page into an Array..
Let me know this..
|
|
|
|
|
Why are you doing that?whats your requirement?
|
|
|
|
|
It is a part of my Project Requirement..
My TL Want's me to do this.
|
|
|
|
|
Loop for each control and collect IDs of TextBox control type.
I Love T-SQL
"Don't torture yourself,let the life to do it for you."
If my post helps you kindly save my time by voting my post.
www.aktualiteti.com
|
|
|
|
|
ok .you can iterate through this.Controls and then check if its typeof(TextBox) and do as per requirements.
|
|
|
|
|
Pawan Kiran wrote: It is a part of my Project Requirement..
Its quite understandable the its your requirement. But, what you are going to do with storing the Textbox ID ? Are they dynamic or Static ?
|
|
|
|
|
Pawan Kiran wrote: My TL Want's me to do this.
I did not think dirty, I swear!
Manas Bhardwaj
Please remember to rate helpful or unhelpful answers, it lets us and people reading the forums know if our answers are any good.
|
|
|
|
|
Hi,
I am making a web form in asp.net?/c#;
I want to know how to know the co ordinates; the x, y coordinates ( in pixels) of a control and also if possible what is the length and breadth( in pixels) of my form.
thanks
|
|
|
|
|
The x,y coordinates of a control are up to you, you can place an element anywhere you'd like.
Browser window size[^]
And, honestly, you could have answered these questions yourself with very little research.
only two letters away from being an asset
|
|
|
|
|
hi i have a link button...,
the link button have 2 modalpopupextender...,
based on the session value i like to view a modalpopupextender...,
but its showing two modal popup extender at a time...,
how to solve this...,
this is my piece code:
<asp:linkbutton id="LinkButton2" runat="server" onclick="LinkButton2_Click">Post Comment
<cc1:modalpopupextender id="ModalPopupExtender1" runat="server" targetcontrolid="LinkButton2"
="" popupcontrolid="divPopUp1" backgroundcssclass="popUpStyle" popupdraghandlecontrolid="panelDragHandle1" dropshadow="false">
<cc1:modalpopupextender id="ModalPopupExtender2" runat="server" targetcontrolid="LinkButton2"
="" popupcontrolid="divPopUp2" backgroundcssclass="popUpStyle" popupdraghandlecontrolid="panelDragHandle2" dropshadow="false">
code bolck:
protected void LinkButton2_Click(object sender, EventArgs e)
{
if (Session["uname"] == null)
{
ModalPopupExtender1.Show();
}
else
{
ModalPopupExtender2.Show();
}
}
Thanks & Regards,
Member 3879881,
please don't forget to vote on the post
|
|
|
|
|
Member 3879881 wrote: protected void LinkButton2_Click(object sender, EventArgs e)
{
if (Session["uname"] == null)
{
ModalPopupExtender1.Show();
}
else
{
ModalPopupExtender2.Show();
}
}
Try To Hide other POPUP Extender alternately.
void LinkButton2_Click(object sender, EventArgs e)
{
if (Session["uname"] == null)
{
ModalPopupExtender1.Show();
ModalPopupExtender2.Hide();
}
else
{
ModalPopupExtender2.Show();
ModalPopupExtender1.Hide();
}
Any Problem with this?
Sundeep Ganiga
When the only tool you have is a hammer, everything looks like a nail.
Come Forth Yourself to Click "Good Answer" for any expected solution.
Let us Support our C Project Programmers who provide solutions here.
|
|
|
|
|
What I have done in the past is to use a dummy control as the TargetControlID and then set the display property of that control to 'None'. The problem you're having is that LinkButton2 activates both ModalPopupExtenders on the client, whereas what you really want to do is show one of them from the server. Placing a hidden dummy control on your form will mean that the ModalPopupExtenders never get activated from the client.
|
|
|
|
|
Dear All,
I am creating a shopping site. With googling I came up with this idea:
1.I will display products within an iframe in a datalist with paging option.
2. All Items will have a button, when you clicked it, item will be selected.
3. There will be a datagrid in another iframe page, the products that have been selected will be put in a basket there.
4. and the confirmation of the purchase will be done at the iframe collecting the basket. Now what I would need to know are.
Now the questions:
1. Is "what I have come up with" a common practice, or is there a better way?
2. How will I relay the data from one iframe to another within the same parent page?
3. How will the parent page be redirected when the purchase confirmation is done.
Thanks alot.
E.E.
|
|
|
|
|
I don't understand why you want to use iframes ?
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
I do not want all page to be reloaded when a button clicked...
Only the necessary part will be reloaded.
I though Ajax, but the datalist paging requires whole page reload.
|
|
|
|
|
If you use properly UpdatePanel then it wont load all page.
I Love T-SQL
"Don't torture yourself,let the life to do it for you."
If my post helps you kindly save my time by voting my post.
www.aktualiteti.com
|
|
|
|
|
there is a panel which holds page numbers in it. The page numbers are filled during page-pre_init so it is reloaded.
here is the html code
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Aşçılar</title>
<link href="style.css" rel="stylesheet" type="text/css" />
</head>
<body>
<form id="form1" runat="server">
<div id="centrallarge">
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<h1><img src="images\digersayfa.jpg" alt="photo" /></h1>
<div id="central" style="Width:900px">
<div id="leftsub" style="Width:250px; height:200px">
<h1 style="height:200px">
<asp:Image ID="Image1" runat="server" Height="130px" Width="130px"
BorderColor="White" BorderStyle="None" BorderWidth="10px" />
</h1>
<p>
<asp:Label ID="lblAd" runat="server" Text="" Font-Names="Tahoma" Font-Size="Small" ForeColor="Red" ></asp:Label>
<br />
<asp:Label ID="lblAdres" runat="server" Text="" Font-Names="Tahoma" Font-Size="Small" ForeColor="Red"></asp:Label>
</p>
</div>
<div id="rightsub" style="Width:600px; font-family:Tahoma; font-size:small; color:Red;" >
<asp:ImageButton ID="ImageButton1" ImageUrl="images\icons\delete.png" runat="server"/> Seçili Menüleri Sil
<br style="height:2px"/>
<img src="images\menu.gif" alt="photo" style="margin-top:5px"/>
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<asp:DataList ID="dlListe" runat="server" RepeatColumns="4"
RepeatDirection="Horizontal" ItemStyle-Font-Names="Tahoma"
ItemStyle-Font-Size="Small" ForeColor="Red"
ItemStyle-HorizontalAlign="Left" Height="450px" ShowFooter="true"
>
<ItemTemplate>
<asp:Image ID="Image1" ImageUrl= <%#DataBinder.Eval(Container.DataItem, "Menu_Image")%> runat="server"
Height="70px" Width="100px" BorderColor="White" BorderWidth="5px" />
<br />
<asp:CheckBox ID="CheckBox1" runat="server" />
<%# DataBinder.Eval(Container.DataItem, "Menu_Adi")%>
<br /> Fiyat:
<%# DataBinder.Eval(Container.DataItem, "Fiyat")%> TL
</ItemTemplate>
<AlternatingItemStyle HorizontalAlign="Left"/>
<ItemStyle HorizontalAlign="Left" VerticalAlign="Top" Font-Names="Tahoma"></ItemStyle>
</asp:DataList>
<asp:Panel ID="pnlBottom" runat="server"> </asp:Panel>
</ContentTemplate>
</asp:UpdatePanel>
</div>
<div id="footersub">
<ul>
<li><a href="Default.aspx">Anasayfa</a></li>
</ul>
</div>
</div>
</div>
</form>
</body>
</html>
|
|
|
|
|
|
hai every body !!!
i got a small doubt . how can i insert dummy data into gridview manually not bind from database.
try and try untill reach success..
|
|
|
|
|
With code. Why do you want to do that ?
Any collection is a valid data source for a grid view.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|