|
For parameter fields you should add prefix @ , like below
Ya Rasoolallah wrote:
string query = "select * from tbl_users where username like @username";
SqlCommand cm = new SqlCommand(query,cn);
cm.Parameters.AddWithValue("@username","N%"+prefixT ext+"%");
thatrajaCode converters | Education Needed
No thanks, I am all stocked up. - Luc Pattyn
When you're wrestling a gorilla, you don't stop when you're tired, you stop when the gorilla is - Henry Minute
|
|
|
|
|
thanks
my friend , still does not work.
why?
test it please.
|
|
|
|
|
I don't think you need N in below line
cm.Parameters.AddWithValue("@username","N%"+prefixText+"%");
Debug your code & make sure you get data in SqlDataReader dr (below line)
while (dr.Read())
Before that make sure you have data in your database table tbl_users.
I think you tried example from this article[^] so make sure you didn't miss any steps mentioned there.
thatrajaCode converters | Education Needed
No thanks, I am all stocked up. - Luc Pattyn
When you're wrestling a gorilla, you don't stop when you're tired, you stop when the gorilla is - Henry Minute
|
|
|
|
|
hello
the problem is not from @ or N and etc...
my program doesn't have any syntax error but doesn't work not at all.
please debug my program to see why not to work?thanks.
i worked from
that example link that you said step by step exactly.
modified 19-Dec-13 12:18pm.
|
|
|
|
|
I have used many time auto complete Extender. I check out your code behind file.
[WebMethod]
public static string[] City(string prefixText, int count, string contextKey)
{
DataTable dt = new DataTable();
dt = Bal_BindingData._city(prefixText);
string[] movies = new string[dt.Rows.Count];
for (int i = 0; i < dt.Rows.Count; i++)
{
movies[i] = dt.Rows[i]["City"].ToString();
}
return movies;
}
i think you forgot string Contextkey Parameter in GetCompletionList method.
don't confused my with code i have used three tire technique. I hope your problem has been solved.
jsb
|
|
|
|
|
I know this question is kind of broad, and I apologize. I read the rules, and think I can ask this. However, if this is against the rules, I'm fine with that and will delete it.
I'm new to C# in general, and am now in the 21st chapter of the book "C# for Programmers, Second Edition" by Deitel (isbn 0-13-134591-5)*. I'm on Visual Studio 2010, and this book's examples deal with 2005. Still, that's been no obstacle up until now, with ASP. I got by OK earlier in the chapter, but I'm now being asked to link a particular database to a datagridview control. When I try to link up this database, I get an error that basically says my version of SQL Server is incompatible with the pre-release version of this database. All solutions to this problem indicate that I'm supposed to install SQL Server 2005 just to update the permissions on this database. I went through a lot just to get 2008 fine and running on my computer, and am not going to dip my toe into that river of confusion.
The thing is: it's this particular database. I tried to import another DB from previous lessons just to see, and that one come in fine. I'm going to try to continue the lesson with that one. However, I feel this will be a growing problem until I get back into non DB stuff later. So, I was wondering what ASP.Net/SQL material you guys would recommend (from here or elsewhere) that's thorough and can match what's in this book. I'm looking around here, but I'm drowning in random topics and don't know what to "trust" because I really don't know where to start.
modified 18-Dec-13 18:19pm.
|
|
|
|
|
If you want to start with ASP.NET the perhaps the book "MCTS -70-515 self paced learning kit" is the best place to start with.
If you want to start ASP.NET MVC then "MvcMusicStore tutorial" from codeplex is the best place to start.
For SqlServer, I think get any book on sql server for developers from Microsoft press and that will do. Just check that the book is meant for developers and not the DBAs.
Twenty years from now you will be more disappointed by the things that you didn't do than by the ones you did do. So throw off the bowlines. Sail away from the safe harbor. Catch the trade winds in your sails. Explore, Dream. Discover.
|
|
|
|
|
tyr this website:
thenewboston.org
|
|
|
|
|
I would like a pass value from custom text box to controller in MVC 4.
How can I do that?
Please advise.
|
|
|
|
|
I am totally new to WCF and web services.
I need to create a REST based wcf service for which I have got the sample walkthrough from code project.
I would like have the Uri Template like https://example.com/{v}/{resource}?filter={attribute}{op}{value}&sortBy={attributeName}&sortOrder={ascending|descending}&attributes={attribute list in csv}
attribute:attribute to be searched
op:operator( format of eq,and,or,neq,like,contains ) value:attribute value to be searched
attributeName:sortBy attribute name
sortOrder should be enum with ascending or descending. attributes:attributeslist in csv
Is this possible?
Could anyone help me in configuring UriTemplate and OperationContract for this?
|
|
|
|
|
It looks like you want query support in URLs so that you can pass in query like URLs and get the filtered data from the server. Why dont you create a WCF data service which will provide this support out of the box. And you can also expose a rest endpoint for the same too.
A Beginner's Tutorial for Creating WCF Data Services[^]
Twenty years from now you will be more disappointed by the things that you didn't do than by the ones you did do. So throw off the bowlines. Sail away from the safe harbor. Catch the trade winds in your sails. Explore, Dream. Discover.
|
|
|
|
|
i am displaying records gridview vertically by converting rows into column hence i want column wise paging in gridview. thanks in advance
|
|
|
|
|
|
I think OP asked for paging..conversion part is already over..
|
|
|
|
|
I won't blame my last coffee, it's my mistake. Sometime it happens. Thanks for the headsup.
thatrajaCode converters | Education Needed
No thanks, I am all stocked up. - Luc Pattyn
When you're wrestling a gorilla, you don't stop when you're tired, you stop when the gorilla is - Henry Minute
|
|
|
|
|
|
Dim fourthOfJuly As New Date(1776, 7, 4)
Dim inTheMorning As New Date(1776, 7, 4, 9, 45, 30)
Why it has been declared like this?? what is the meaning??
cant we give it as simply date??
|
|
|
|
|
Choose right forum for your question. You should have posted this question in Visual Basic forum[^]
tsunamigang wrote: Dim fourthOfJuly As New Date(1776, 7, 4)
Dim inTheMorning As New Date(1776,
7, 4, 9, 45, 30) Didn't the ToopTip tell you when you put left parathesis in VS?
Those're parameters like Year, Month, Day, Hour, Minute, Second., And there're many overloads.
Check this one to learn more
DateTime Structure[^]
thatrajaCode converters | Education Needed
No thanks, I am all stocked up. - Luc Pattyn
When you're wrestling a gorilla, you don't stop when you're tired, you stop when the gorilla is - Henry Minute
|
|
|
|
|
I'm using nested gridview for saving and displaying comments and replies on my webforms. Reason why I used nested gridview for my comment section page is because I have reply option and I want to display the replies under the comment that has been replied to. The replies are displayed from the ChildGridview and I'm saving the replies using the ParentGridView onrowcommand.
I noticed that everytime you use the gridview onrowcommand event, the gridview will automatically do postback like you reload the page so what happen is the user can't see his reply immediately because the page has postedback and he has to go back to click the reply button in order to see his reply. I want it to be static and automatically load its reply on the page after posting it.
Refer this link for more example: http://money.msn.com/exchange-traded-fund/3-reasons-to-invest-in-made-in-usa
Did you see the comments with reply on there?If you try to reply some comments on that link you will immediately see your reply because it did not reload or postback that you need to find the comment where you reply and click the reply button just to see your reply because the reply you post will automatically be loaded. How do I do like that same on that link. Any suggestions? I hope you'll be able to figure out what I meant...Thanks
|
|
|
|
|
Use Updatepanel to overcome this.
Quote: If you try to reply some comments on that link you will immediately see your reply because it did not reload or postback
No.It will postback to the server.It looks like it doesn't because of updatepanel or something else(but surely it process the postback)
To learn all there is to know. I know I'll be disappointed one day, but I've made a good start, and the eventual disappointment is likely to be brief.
-Roger Wright
Never doubt that a small group of thoughtful, committed people can change the world. Indeed, it is the only thing that ever has.-Margaret Mead
|
|
|
|
|
Jas24 wrote: Use Updatepanel to overcome this.
Hi!
I haven't tried to use Updatepanel eversince yet so I was kind of getting difficulty on how to deal the Updatepanel with my gridview to overcome this. How do I use updatepanel with gridview control to deal this kind of scenario. I'm gonna give you my mark-up and I hope you'll be able to help me resolve this issue...Thanks
Here's my mark-up below:
asp:GridView ID="gvParentGrid" runat="server" Width="395px"
AutoGenerateColumns="false" GridLines="None" BorderStyle="Solid" BorderWidth="0px"
BorderColor="White" DataKeyNames="ID" onrowcommand="gvParentGrid_RowCommand"
onrowdatabound="gvParentGrid_RowDataBound" >
<Columns>
<asp:TemplateField >
<ItemTemplate>
<tr>
<td id ="comment" class ="highlightab" style ="border-bottom :2px solid Blue;border-bottom-color :Gray; border-left :0px; border-left-color :White; border-right :0px; border-right-color :White; border-top :0px; border-top-color :White;background-color :White;border-bottom :2px solid Blue;border-bottom-color :Gray; border-left :0px; border-left-color :White; border-right :0px; border-right-color :White; border-top :0px; border-top-color :White;background-color :White; height :100px; width :395px; margin-bottom :5px">
<asp:Image ID="Image1" runat="server" style=" margin-right :5px; background-image :url('Image/imagebackground.png');" ImageAlign ="Left" Height ="60px" Width="60px" />
<asp:Label ID ="ComID" runat ="server" style="display :none" Text =' <%#Eval("ID") %>' />
<asp:Label ID="name" runat="server" Font-Bold="True" Text='<%# Eval("Name")%>' ForeColor="Blue"></asp:Label>
<p id ="content" class="minimize" style =" border-radius: 4px 4px 4px 4px; max-width :395px; min-height :5px; margin-top :5px; margin-bottom :5px; margin-left :65px; display :block; background-color: #CCCCFF;"> <%# DataBinder.Eval(Container.DataItem,"Comments").ToString() %> </p>
<a href="JavaScript:divexpandcollapse('div<%# Eval("ID") %>');" style ="margin-left :65px; margin-top :1px" >
<input id="btndiv<%# Eval("ID") %>" type="button" value="Reply" style ="border:0px; background-color :White; color :blue; cursor :pointer " />
</a>
</td>
</tr>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField>
<ItemTemplate>
<div id="div<%# Eval("ID") %>" style="display: none; position:relative; left: 65px; overflow: auto; margin-top :1px">
<asp:GridView ID="gvChildGrid" runat="server" AutoGenerateColumns="false" BorderStyle="Double" BorderColor="white" GridLines="None" Width="325px" onrowcommand="gvChildGrid_RowCommand" onrowdatabound="gvChildGrid_RowDataBound">
<Columns >
<asp:TemplateField >
<ItemTemplate >
<tr>
<td style ="border-bottom :2px solid Blue;border-bottom-color :Gray; border-left :0px; border-left-color :White; border-right :0px; border-right-color :White; border-top :0px; border-top-color :White;background-color :White; height :100px; width :325px">
<asp:Image ID="Image1" runat="server" style=" margin-right :5px; background-image :url('Image/imagebackground.png');" ImageAlign ="Left" Height ="60px" Width="60px" />
<asp:Label ID="name" runat="server" Font-Bold="True" Text='<%# Eval("Name")%>' ForeColor="Blue"></asp:Label>
<p id ="content" class="minimize" style =" border-radius: 4px 4px 4px 4px; max-width :325px; min-height :5px; margin-top :5px; margin-left :65px; display :block; background-color: #CCCCFF;"> <%# DataBinder.Eval(Container.DataItem,"Replies").ToString() %> </p>
</td>
</tr>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
<asp:Label ID="Label1" runat="server" Text="Name"></asp:Label>
<br />
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
<br />
<asp:TextBox ID="TextBox2" Height ="200px" Width ="325px" TextMode ="MultiLine" runat="server"></asp:TextBox>
<br />
<asp:Button ID="Button1" runat="server" Text="Post Reply" onclick="Button1_Click" />
</div>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView
|
|
|
|
|
Hi!
It not a big issue
Place ScriptManager or ToolScriptManager (Ajax) inside the form tag.
Then paste the gridview codeblock inside it.
Try this:
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
</ContentTemplate>
</asp:UpdatePanel>
To learn all there is to know. I know I'll be disappointed one day, but I've made a good start, and the eventual disappointment is likely to be brief.
-Roger Wright
Never doubt that a small group of thoughtful, committed people can change the world. Indeed, it is the only thing that ever has.-Margaret Mead
modified 18-Dec-13 0:55am.
|
|
|
|
|
I tried to use the new mark-up you gave me and I also tried to put the child gridview inside the updatepanel and the last mark up I finally came up to is shown below so I was modifying the mark-up for the third time but none of them works, the problem is getting worse because my gvParentGrid_RowCommand is not firing anymore and it does nothing no matter how many times you click the button. What did we miss from this? Here's my update mark-up on my webform...
asp:GridView ID="gvParentGrid" runat="server" Width="395px"
AutoGenerateColumns="false" GridLines="None" BorderStyle="Solid" BorderWidth="0px"
BorderColor="White" DataKeyNames="ID" onrowcommand="gvParentGrid_RowCommand"
onrowdatabound="gvParentGrid_RowDataBound" >
<Columns>
<asp:TemplateField >
<ItemTemplate>
<tr>
<td id ="comment" class ="highlightab" style ="border-bottom :2px solid Blue;border-bottom-color :Gray; border-left :0px; border-left-color :White; border-right :0px; border-right-color :White; border-top :0px; border-top-color :White;background-color :White;border-bottom :2px solid Blue;border-bottom-color :Gray; border-left :0px; border-left-color :White; border-right :0px; border-right-color :White; border-top :0px; border-top-color :White;background-color :White; height :100px; width :395px; margin-bottom :5px">
<asp:Image ID="Image1" runat="server" style=" margin-right :5px; background-image :url('Image/imagebackground.png');" ImageAlign ="Left" Height ="60px" Width="60px" />
<asp:Label ID ="ComID" runat ="server" style="display :none" Text =' <%#Eval("ID") %>' />
<asp:Label ID="name" runat="server" Font-Bold="True" Text='<%# Eval("Name")%>' ForeColor="Blue"></asp:Label>
<p id ="content" class="minimize" style =" border-radius: 4px 4px 4px 4px; max-width :395px; min-height :5px; margin-top :5px; margin-bottom :5px; margin-left :65px; display :block; background-color: #CCCCFF;"> <%# DataBinder.Eval(Container.DataItem,"Comments").ToString() %> </p>
<a href="JavaScript:divexpandcollapse('div<%# Eval("ID") %>');" style ="margin-left :65px; margin-top :1px" >
<input id="btndiv<%# Eval("ID") %>" type="button" value="Reply" style ="border:0px; background-color :White; color :blue; cursor :pointer " />
</a>
</td>
</tr>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField>
<ItemTemplate>
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<div id="div<%# Eval("ID") %>" style="display: none; position:relative; left: 65px; overflow: auto; margin-top :1px">
<asp:GridView ID="gvChildGrid" runat="server" AutoGenerateColumns="false" BorderStyle="Double" BorderColor="white" GridLines="None" Width="325px" onrowcommand="gvChildGrid_RowCommand" onrowdatabound="gvChildGrid_RowDataBound">
<Columns >
<asp:TemplateField >
<ItemTemplate >
<tr>
<td style ="border-bottom :2px solid Blue;border-bottom-color :Gray; border-left :0px; border-left-color :White; border-right :0px; border-right-color :White; border-top :0px; border-top-color :White;background-color :White; height :100px; width :325px">
<asp:Image ID="Image1" runat="server" style=" margin-right :5px; background-image :url('Image/imagebackground.png');" ImageAlign ="Left" Height ="60px" Width="60px" />
<asp:Label ID="name" runat="server" Font-Bold="True" Text='<%# Eval("Name")%>' ForeColor="Blue"></asp:Label>
<p id ="content" class="minimize" style =" border-radius: 4px 4px 4px 4px; max-width :325px; min-height :5px; margin-top :5px; margin-left :65px; display :block; background-color: #CCCCFF;"> <%# DataBinder.Eval(Container.DataItem,"Replies").ToString() %> </p>
</td>
</tr>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
<asp:Label ID="Label3" runat="server" Text="Name"></asp:Label>
<br />
<asp:TextBox ID="TextBox3" runat="server"></asp:TextBox>
<br />
<asp:TextBox ID="TextBox4" Height ="200px" Width ="325px" TextMode ="MultiLine" runat="server"></asp:TextBox>
<br />
<asp:Button ID="Button2" runat="server" Text="Post Reply" CommandName="reply" />
</div>
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="Button2" />
</Triggers>
</asp:UpdatePanel>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView >
|
|
|
|
|
 I tried a similar one it works fine for me.
Try like this:
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
asp:GridView ID="gvParentGrid" runat="server" Width="395px"
AutoGenerateColumns="false" GridLines="None" BorderStyle="Solid" BorderWidth="0px"
BorderColor="White" DataKeyNames="ID" onrowcommand="gvParentGrid_RowCommand"
onrowdatabound="gvParentGrid_RowDataBound" >
<Columns>
<asp:TemplateField >
<ItemTemplate>
<tr>
<td id ="comment" class ="highlightab" style ="border-bottom :2px solid Blue;border-bottom-color :Gray; border-left :0px; border-left-color :White; border-right :0px; border-right-color :White; border-top :0px; border-top-color :White;background-color :White;border-bottom :2px solid Blue;border-bottom-color :Gray; border-left :0px; border-left-color :White; border-right :0px; border-right-color :White; border-top :0px; border-top-color :White;background-color :White; height :100px; width :395px; margin-bottom :5px">
<asp:Image ID="Image1" runat="server" style=" margin-right :5px; background-image :url('Image/imagebackground.png');" ImageAlign ="Left" Height ="60px" Width="60px" />
<asp:Label ID ="ComID" runat ="server" style="display :none" Text =' <%#Eval("ID") %>' />
<asp:Label ID="name" runat="server" Font-Bold="True" Text='<%# Eval("Name")%>' ForeColor="Blue"></asp:Label>
<p id ="content" class="minimize" style =" border-radius: 4px 4px 4px 4px; max-width :395px; min-height :5px; margin-top :5px; margin-bottom :5px; margin-left :65px; display :block; background-color: #CCCCFF;"> <%# DataBinder.Eval(Container.DataItem,"Comments").ToString() %> </p>
<a href="JavaScript:divexpandcollapse('div<%# Eval("ID") %>');" style ="margin-left :65px; margin-top :1px" >
<input id="btndiv<%# Eval("ID") %>" type="button" value="Reply" style ="border:0px; background-color :White; color :blue; cursor :pointer " />
</a>
</td>
</tr>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField>
<ItemTemplate>
<!--This is the child gridview -->
<div id="div<%# Eval("ID") %>" style="display: none; position:relative; left: 65px; overflow: auto; margin-top :1px">
<asp:GridView ID="gvChildGrid" runat="server" AutoGenerateColumns="false" BorderStyle="Double" BorderColor="white" GridLines="None" Width="325px" onrowcommand="gvChildGrid_RowCommand" onrowdatabound="gvChildGrid_RowDataBound">
<Columns >
<asp:TemplateField >
<ItemTemplate >
<tr>
<td style ="border-bottom :2px solid Blue;border-bottom-color :Gray; border-left :0px; border-left-color :White; border-right :0px; border-right-color :White; border-top :0px; border-top-color :White;background-color :White; height :100px; width :325px">
<asp:Image ID="Image1" runat="server" style=" margin-right :5px; background-image :url('Image/imagebackground.png');" ImageAlign ="Left" Height ="60px" Width="60px" />
<asp:Label ID="name" runat="server" Font-Bold="True" Text='<%# Eval("Name")%>' ForeColor="Blue"></asp:Label>
<p id ="content" class="minimize" style =" border-radius: 4px 4px 4px 4px; max-width :325px; min-height :5px; margin-top :5px; margin-left :65px; display :block; background-color: #CCCCFF;"> <%# DataBinder.Eval(Container.DataItem,"Replies").ToString() %> </p>
</td>
</tr>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
<asp:Label ID="Label1" runat="server" Text="Name"></asp:Label>
<br />
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
<br />
<asp:TextBox ID="TextBox2" Height ="200px" Width ="325px" TextMode ="MultiLine" runat="server"></asp:TextBox>
<br />
<asp:Button ID="Button1" runat="server" Text="Post Reply" onclick="Button1_Click" />
</div>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView
</ContentTemplate>
</asp:UpdatePanel>
To learn all there is to know. I know I'll be disappointed one day, but I've made a good start, and the eventual disappointment is likely to be brief.
-Roger Wright
Never doubt that a small group of thoughtful, committed people can change the world. Indeed, it is the only thing that ever has.-Margaret Mead
|
|
|
|
|
How does it works for you? Does it the same behavior from the link I gave if you make reply on any comments? Using that mark-up won't still behave the same from that link when you comment I don't know why? I tried also to rebind the ChildGridview after the posting the reply but still the same it won't reload the ChildGridview automatically but you still need to reload the page and go back to reply button before you can see your new reply.
|
|
|
|